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.

How can I set full permissions to a user in a specified dir in linux?

share|improve this question

4 Answers 4

up vote 7 down vote accepted

Depends what you mean 'full permissions'. If you want a user to have full read and write access to all files and directories in that directory, then this will help:

chown -R username directory
chmod -R u+rX directory

The first command makes the user own the directory. The second command gives them full read and access permissions. The r gives read permission, the X gives 'execute' permission to directories, and not files.

share|improve this answer
    
The problem with setting the permission that way is you make every file executable which may not necessarily be a good idea. Generally speaking in less you know what files you're dealing with(or you just don't care) I wouldn't apply permissions to a whole directory tree this way. –  einstiien Jan 22 '10 at 23:32
1  
Nope, that doesn't set all files executable, it will only set the directories 'executable'. That's the difference between x and X. –  Rory Jan 22 '10 at 23:50
    
Sorry, didn't see the capital. –  einstiien Jan 23 '10 at 9:30

If you do not wish to change the existing permissions of the directory, yet would like to give a user (or multiple users or groups) permissions to the contents of the directory, you can use ACLs. Some filesystems (ext3) require the acl flag on mount to enable ACLs. Often, just using groups is sufficient, but ACLs can be more flexible.

Look at the setfacl and getfacl commands for more information.

share|improve this answer

The two solutions previous to my comment assume that you only want a SINGLE person to have full access to a directory and its sub-directories and files below it.

Is that correct or do you want MULTIPLE people to have full access to that specific directory?

share|improve this answer

You can give the user ownership with the following command:
chown -R username:groupname directory

Permissions are controlled with chmod but more than likely if you give the user ownership the permissions should already be set to give them full access.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.