Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is this possible?

It seems that I have more options to set permissions in Windows than Linux.

Let's say I want to give a user full access to a top-level directory but limit their access to certain subdirectories.

Going one step further, how would I do this for multiple users?

share|improve this question

migrated from serverfault.com Feb 3 '13 at 22:52

This question came from our site for professional system and network administrators.

2  
Linux permissions are a bit restrictive but the way I would do it would be to set a different group at each directory level, then add the relevant users into the relevant groups. –  Christian Feb 3 '13 at 16:00

3 Answers 3

In POSIX systems, a file can only have one user owner and one group owner. Normal posix permissions affect the access of the user owner, group owner, and everyone. I'll assume that you are already familiar with those.

In addition on Linux, an extended form of ACLs is available that allows specifying access permissions for additional users and groups. In Linux, most filesystems have to be specifically mounted with options to enable the storage of these ACLs. Usually, the mount option is "acl". That option is definitely supported by ext2/3/4 FSes. You can check for the option running the following in bash:

$ mount

or

$ cat /proc/self/mounts

Then look to see if the filesystem where you want to apply the ACLs has that mount option enabled. Assuming it does, you can use the getfacl and setfacl commands to manipulate the acls on file and directories. Here's an example of running getfacl:

$ getfacl ipxe/
# file: ipxe/
# owner: wt
# group: wt
user::rwx
group::rwx
other::r-x

In this case, I don't have any extended ACLs on the directory. If I had given user "foo" "rwx" permissions on that directory, you'd see an entry like user:foo:rwx in that output.

I hope this helps. Good luck.

share|improve this answer
    
Thank you for the detailed description Warren. How would I revoke one's privileges to a subfolder, though? –  Addikt Feb 4 '13 at 4:25

"Permissions" in LINUX are handled by two mechanisms:

  1. ownership
  2. Read, Write, and Execute permissions.

Every file (or directory) has an owner and a group owner. See man pages for chown or the wiki

chown user:group file

Permission are set for the owner, the group and others. See man pages for chmod. or the wiki

chmod [options] file

options is either a numerical permission or a symbolic mode. (see the documentation or the wiki to understand this in better detail)

Users can be part of multiple groups.

share|improve this answer

You could invoke Linux ACLs if you are using an appropriate filesystem and have them activated.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.