Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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.

share|improve this answer
    
Why not include the command syntax since the OP might not be familiar with the commands? –  einstiien Feb 23 '10 at 5:05
    
I don't want to chnage the owner , as i want original owner to do read and write as well –  John Feb 23 '10 at 5:06
    
Thanks Burton, didn't mean to be a pest just think its more helpful for everyone. :) –  einstiien Feb 23 '10 at 5:38
    
Nah I appreciate it, I'm still pretty new here. –  Burton Feb 23 '10 at 5:40

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 {} \;
share|improve this answer

Your Answer

 
discard

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