Setting permission for multiple users to a directory
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Setting permission for multiple users to a directory
Hi,
I'm a linux newbie and I'm having trouble breaking down permissions in linux. Here's the scenario.
I have two users: UserA & UserB with each having to ownership and access to directories myDirA and myDirB respectively.
UserA --> /source/myDirA
UserB --> /source/myDirB
I need to set the permissions so that userA can access myDirA and myDirB. There are other users and directories but they should not be able to view outside of their own directories (which is the way it is now).
I don't have groups set up for them and I'd rather not change anything else but just the permissions.
rwxr_x_r_x UserA
rwxr_x_r_x UserB
They're read/write/exec permissions are identical.
I think you should have a group of users to have access of a file to different users.
So create a group containing the users whom you want to access the files/directories and make respective file permission changes to those.
Also, have a look at man chown on how to achieve this.
man, first of all, whenever you post a question on LQ, must mention you distro!
Now about your question, you should read about ACLs (Access Control Lists) on directory and files, lets say if you are using Red Hat Linux, the command is "setfacl" for setting up ACL on a particular directory,
Quote:
I need to set the permissions so that userA can access myDirA and myDirB. There are other users and directories but they should not be able to view outside of their own directories (which is the way it is now).
type this command
Code:
setfacl -m u:userA:rwx myDirB/
this command will give read-write-execute permission to the userA on directory myDirB, you can setup permission to any directory like this regardless of what permissions and ownership you have already set on your directories.
This answer was just for help, you should read about ACLs in your distro and then you can set even more complex permissions in the future.
Regards
Last edited by saifkhan123; 02-25-2010 at 11:52 PM.
Please post the results of "mount". The filesystem type needs to support ACLs and you need to add the "acl" option to it's entry in /etc/fstab. But for only two users, what you want to do is done easily by creating a group for the purpose of sharing files in a directory. That is what groups are for. When you need to use acls, is when more users need access but that access is different. Suppose you have two users who can create files. A group of users who read the files they produce but don't have permission to create files in the directory.
No ... ACL support should take effect automatically if you did the remount correctly. You're using ext2 ... according to my man page ext2 should support ACLs, but maybe you've got an older kernel. What distro and version are you using? I don't see why in this case, though, you would just create a group to do this as was mentioned above.
No ... ACL support should take effect automatically if you did the remount correctly. You're using ext2 ... according to my man page ext2 should support ACLs, but maybe you've got an older kernel. What distro and version are you using? I don't see why in this case, though, you would just create a group to do this as was mentioned above.
Actually this is not me who started this thread. But, I am just interested to know the different option (using setfacl) than the option I too mentioned(using groups).
I already mentioned my distro. For that please refer to above replies by me.
I run the command as:
Code:
[root@station130 ~]# mount -o remount,acl /home
mount: can't find /home in /etc/fstab or /etc/mtab
so I edited the /etc/fstab file by making some entry as:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.