I have a Group 'g1' having 2 users Alice and Bob. I want to share a file 'file1' with both of them with different permissions.(for Alice read only and for Bob Read+write)
Asked
Active
Viewed 8.6k times
16
-
You have to create separate groups or use ACL fs extension – Maciej Gol Oct 12 '13 at 17:44
2 Answers
16
Assuming Bob can own the file the following should work for you.
$ chown Bob:g1 file1
First set the ownership of the file to Bob to allow for read+write access and set the group ownership to the g1 group.
$ chmod 640 file1
Set the owner to a read and write and set the group to read only. This is a common permission structure on webservers. Note that the "world" has no permissions in this structure, but $ man chmod can provide further information on file permissions and get you where you are needing to go. Additionally if you need more control over your permissions across the whole system you may want to look into Posix ACLs or SE Linux as you did indicate you are on RedHat

MattSizzle
- 3,145
- 1
- 22
- 42
3
You may try like this in Linux:-
chown user_name file
chown user_name folder
chown -R user_name folder #recursive

Rahul Tripathi
- 168,305
- 31
- 280
- 331
-
1Your Answer can't give different permissions to 2 different Users in a same Group. – Vijay Oct 12 '13 at 17:58
-
@VijayPandey:- Are you looking for something like this:- example% chmod [who][op][permissions] filename ? – Rahul Tripathi Oct 12 '13 at 17:58
-
@VijayPandey:- I dont think you can do this. You can create a new group and then give permissions to that. – Rahul Tripathi Oct 12 '13 at 18:00
-