I have different folders in a linux (certos) directory.
Now i want only one user out of all to have read/write permission to all those folders.
How can i do that
thanks
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI have different folders in a linux (certos) directory.
Now i want only one user out of all to have read/write permission to all those folders.
How can i do that
thanks
EDIT: I don't want to chnage the owner , as i want original owner to do read and write as well
Then you should create a group that includes the original owner as well as this other user and set group permissions to that folder with the new group.
Example, you have 2 users - user1 and user2.
Create a new group that contains only the users you want to have access:
groupadd newgroup
Assign each of those users to that group:
usermod -G newgroup user1
usermod -G newgroup user2
Change ownership and permissions of the directory, do this for each folder:
chown user1:newgroup FOLDER_EXAMPLE
chmod 770 FOLDER_EXAMPLE
I believe this is what you are after.
In addition to Burton's answer you probably also want the folder and all containing folders to have the setguid bit set so that new files that are created in them are also owned and writable by the group.
If no sub folders have been created you'll be able to get away with a:
chmod g+s FOLDER_EXAMPLE
If people have already started working, you can do the same thing with find:
find FOLDER_EXAMPLE -type f -exec chmod g+s {} \;