Question

Best Way to Manage Share Permissions

Asked by: BNLIND

I have successfully installed CentOS and joined it to a Windows 2003 Active Directory Domain with Winbind and Samba. We are moving one of our file servers over to CentOS. One of the things I am having trouble figuring out is assigning permissions to file shares.

In case you are curious as to how I set this up, I followed this tutorial:
http://www.linuxmail.info/active-directory-integration-samba-centos-5/

To give an example, say we have a share called "Shared", which we want the "Domain Users" group to be able to access and write to. Now say we have a folder inside of that share called "Secret". We only want the "Secret Agents" group to be able to read and write to that folder. It should become clear that restricting access to a subfolder of a Samba share is either impossible or difficult to set up, which is what got me into looking at using POSIX ACLs.

My first question is: Is this a good way to go about setting this up? Your first thought may be to break the "Secret" folder out onto its own share, but since in real life, we have lots and lots of subfolders inside shares with different sets of permissions, giving each differing folder its own share would become a nightmare.

My second question is: If using POSIX ACL's is a good way, then would the ACL's be left intact if files and folders were backed up and restored. Would they also be left intact if say, the server blows up and we restored those files and folders to another server?

I don't know a whole lot about POSIX ACL's. I just learned about them today. So if there are any potential problems or "catches" that you think I should know about, please include those too.


Thanks for your time

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-13 at 18:38:37ID24651793
Tags

samba

,

acl

,

linux

,

centos

,

permissions

,

file sharing

Topics

CentOS

,

Samba File Server

,

Linux

Participating Experts
2
Points
500
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. permissions on samba shares
    Hi, As a newbie I am confused and bewildered by this. I have an nt4 pdc, 70 98se clients, 2 redhat 6.2 servers both running samba. I have upgraded samba to 2.2.7a on the RH servers as i want to tighten security. security level = domain is now set up on samba and it sucessful...
  2. Samba Share Permissions
    How do I view and set Samba share permissions? I don't see anything for permissions in the smb.conf file.
  3. Convert NTFS permissions to Unix Permissions on SAMBA …
    Is there any easy way to mass convert the NTFS permissions of folders + files to Unix Permissions on the other side of a SAMBA share? Will SFU on the NT side + access via NFS allow the conversion? Other ways to get the files over with permissions mostly intact?
  4. Samba: ACLs, Inheritance and Ownership
    Hey guys, I've been struggling with a Samba installation on Solaris. Before I give up and go with something much simpler for the access control I'd like to have a final pop and getting it to work as I want. Samba 3.2.1 is running on Solaris 10 patch 5, the server is a membe...
  5. samba not sharing according to permissions
    samba is not sharing according to file permission shares example -rwxrwx--- 1 user1 everybody 130K Jun 17 11:47 notes1.pdf -rwxrwx---+ 1 user2 everybody 32K Jul 15 15:32 notes2.xls -rwxrwx---+ 1 user1 everybody 44K Jul 15 14:17 notes3.doc everyone can access notes1 ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: it4sohoPosted on 2009-08-14 at 10:11:40ID: 25100213

If CentOS and Samba were setup correctly, then you should be able to copy the files from the old Windows Server to the CentOS/Samba server (using CIFS) and preserve the permissions automatically.

(In other words, you've already got the Samba server on the AD domain, so it should have no problem mapping the AD groups to Linux groups automagically (actually, the winbindd daemon assigns a unique GID for each AD user and group that it encounters that is not otherwise mapped into the Linux system).

Now, for the "special" groups, like Domain Admins and Domain Users, I recommend mapping them to "real" POSIX accounts:
 - Add POSIX groups for "admins" and "users"
 - Map those groups to the Domain Admins & Domain Groups as here:
    net groupmap add ntgroup="Domain Admins" unixgroup=admins rid=512 type=d
    net groupmap add ntgroup="Domain Users" unixgroup=users rid=513 type=d

The problem many *nix admins run into is that they want to do everything from the *nix side -- and in this case, that's a problem... just copy the files FROM the old server to the new one (using Windows). Now the issue with just a "straight copy" is that the copier will be the owner of everything copied --- unless you use ntbackup (or some other backup program)... so, follow these steps:

On the old (Win) server, use ntbackup to backup the shared files to file X.bkp
When completed, again on the OLD server, use ntbackup to restore those files -- but this time to the network share folder on the NEW server (a mounted [mapped] drive works best for ntbackup!)

ntbackup's restore function should allow you to restore all of the permisions, and winbindd on the samba side should automagically create the *nix version of a user/group id for each file.

Good luck!

Dan
IT4SOHO

 

by: BNLINDPosted on 2009-08-14 at 10:23:38ID: 25100312

Wow, I guess I didn't realize it could be that simple! So would I be able to modify permissions on a folder from a Windows XP machine (logged in under Administrator) as if it was a Windows file server?

I know you can't modify Samba's share permissions using MMC like you could if it was a Windows Server, but we usually just give Everyone full access to the shares and let the ACL file permissions take care of security.

So as long as we could change those ACL permissions easily (like we do now) or at worst have a gui on the server that can do it, we should be all set.

 

by: BNLINDPosted on 2009-08-14 at 11:21:32ID: 25100846

And what type of filesystem should I use on the drives that are going to hold the data? Is ext3 sufficient or should I used something like XFS?

 

by: it4sohoPosted on 2009-08-14 at 12:53:20ID: 25101745

My recommendation on the filesystem would depend on the kinds of data being stored... large filesystem with large files (like movies, or database files) would best be served with XFS, smaller more numerous files are probably better off on ext3.

BTW: the list of permissions and how they are set are similar (but not entirely the same) to what any client system could do while connected to a Win server. (Open the properties, look at advanced security and you'll see permissions as if it were a Windows server)

Dan
IT4SOHO

 

by: BNLINDPosted on 2009-08-14 at 13:23:32ID: 25101979

Sorry to get caught up in the other thread, my question was answered and I'm going to close that one. But here's the problem so far:

Whenever copying files from an existing Windows file server, as you suggested, it does not copy the ACL permissions with it. Instead, it creates three ACL entries: Domain Users, Everyone, and the person who copied the files. All three of these entries get Full Control.

Below is my current smb.conf file. It was initially created by SWAT.

[global]
        workgroup = BNL
        realm = BNL.LOCAL
        server string = Samba Server Version %v
        security = ADS
        allow trusted domains = No
        obey pam restrictions = Yes
        password server = bnldc1.bnl.local bnldc2.bnl.local
        passdb backend = tdbsam
        idmap backend = idmap_rid:bnl=16777216-33554431
        idmap uid = 16777216-33554431
        idmap gid = 16777216-33554431
        winbind enum users = Yes
        winbind enum groups = Yes
        winbind use default domain = Yes
        cups options = raw
 
[printers]
        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No
 
[Shared]
        comment = Shared Drive
        path = /media/storage1/Shared
        read only = No
        force create mode = 766
        force directory mode = 277

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:

Select allOpen in new window

 

by: BNLINDPosted on 2009-08-14 at 13:36:21ID: 25102097

I would also like to add that I tried to modify the permissions on a folder from an XP client and no matter what I do, the permissions get reset to Domain Users (Full), Everyone (Full), and my username (Full).

 

by: fosiul01Posted on 2009-08-14 at 13:51:23ID: 25102224

Ok have a look to

http://www.bluelightning.org/linux/samba_acl_howto/

FAQ 3.1
 see if that make sense ...

 

by: it4sohoPosted on 2009-08-14 at 13:58:22ID: 25102270

The permissions are being forced to full-share mode by your smb.conf file... you HAVE told it to FORCE the mode to 766

If you just want the DEFAULT create mode to be something else, then take away the force part.

Also, permissions work the same on Samba as on a Windows server -- when you COPY files, the new files have the permissions of the user who is doing the copying. To preserve the permissions, use a backup/restore function (like ntbackup)

Good Luck!

Dan
IT4SOHO

PS: I was working in the other thread as well... I'm not a big fan of just turning off SELinux, but if you're comfortable with that, OK...

 

by: BNLINDPosted on 2009-08-14 at 13:59:18ID: 25102281

Well, it sounds similar, but I can't get ANY permissions to stick. They say they have problems removing the Everyone group, I can't add, remove, or change permissions on any group at all.

 

by: fosiul01Posted on 2009-08-14 at 13:59:32ID: 25102283

also, i will tell you to read this one

http://searchenterpriselinux.techtarget.com/tip/0,289483,sid39_gci1080966_mem1,00.html

you might have to create an account in their but its explaining , about what you are trying to do

have a look, might give you an idea..

 

by: fosiul01Posted on 2009-08-14 at 14:07:57ID: 25102359

just to add something,  
its seems @it4soho has good experiences in Samba , so he can be correct me  if i am saying anything wrong about ACL

one thing i realized , here ACL is the main part,without ACL enables Samba will not copy windows permission to Samba ..

is your ACL is enabled??

what this command say

 mount -t ext3
 
http://aisalen.wordpress.com/2007/08/10/acls-on-samba/

 

by: BNLINDPosted on 2009-08-14 at 14:31:42ID: 25102526

Below is the output from mount -t ext3. I am reading that article now.

/dev/mapper/VolGroup01-LogVol00 on / type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
/dev/sdb1 on /media/storage1 type ext3 (rw)
/dev/sdc1 on /media/storage2 type ext3 (rw)

                                              
1:
2:
3:
4:

Select allOpen in new window

 

by: BNLINDPosted on 2009-08-14 at 14:34:49ID: 25102550

And after I read the article, I changed the /etc/fstab file, the did a umount on storage1 and storage2, then did a mount -a. Running mount -t ext3 again, the following is what it returns (which looks good)

/dev/mapper/VolGroup01-LogVol00 on / type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
/dev/sdb1 on /media/storage1 type ext3 (rw,acl)
/dev/sdc1 on /media/storage2 type ext3 (rw,acl)

                                              
1:
2:
3:
4:

Select allOpen in new window

 

by: BNLINDPosted on 2009-08-14 at 14:43:39ID: 25102617

That definitely made a difference. I can actually apply permissions now. Copying from a Windows server is still a little weird, but I'll report back when I can figure out what's going on.

 

by: BNLINDPosted on 2009-08-18 at 15:07:18ID: 31617347

Thanks to both of you. Using NTBackup seems to preserve the permissions, once you enable ACLs on the filesystem that is doing the sharing.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...