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. Please help. Thanks. |
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. HTH |
You need to add UserA to the same group UserB is in.
|
thats easy
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:
Code:
setfacl -m u:userA:rwx myDirB/ 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 |
saifkhan123,
Thats really an important information.... :) I tried that as below: Code:
[root@station130 home]# setfacl -m u:Ashok:rwx srinivas/PerlEx/ But it's not happening. Can you please help me? |
Quote:
Code:
rpm -q acl Also Read ACL details here http://www.redhat.com/docs/manuals/e...s-setting.html hope this will help |
I think I did the same as what the link you posted suggest. But why am I getting this problem "operation not supported"?
|
Quote:
|
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.
|
Quote:
Code:
[Ashok@station130 ~]$ rpm -q acl Code:
[Ashok@station130 ~]$ cat /etc/fstab |
@ashok.g
try this
Code:
# mount -o remount,acl /home |
Change the mount options of your root partition to "defaults,acl".
|
I'm getting the same output even now. Do I need to restart any services for this to happen???
|
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.
|
Quote:
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 Code:
none /home ext2 defaults,acl 1 1 Code:
[root@station130 ~]# cat /etc/fstab Code:
[root@station130 ~]# mount -o remount,acl /home |
What kind of system are you running? Your /home isn't assigned a device and isn't mounted.
Did you add the line with /home yourself? If so, remove it. If your home directory isn't under /home, then post the home directory field of your /etc/passwd file. If /home is a directory of root (/) then add the acl option to the root partition. Without rebooting, you will need to mount the root partition manually with the `remount' option to change the mount options. Might as well reboot after correcting the /home line. |
my home directory is under root itself.
Now I am getting that fine. Thanks all for your replies and hope sen(the thread beginner) also clarified his doubts. Happy posting LQ :):D:cool: |
All times are GMT -5. The time now is 03:30 AM. |