How can I set full permissions to a user in a specified dir in linux?
-
You can give the user ownership with the following command:
chown -R username:groupname directoryPermissions are controlled with
chmodbut more than likely if you give the user ownership the permissions should already be set to give them full access.From einstiien -
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 directoryThe first command makes the user own the directory. The second command gives them full read and access permissions. The
rgives read permission, theXgives 'execute' permission to directories, and not files.einstiien : 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.Rory McCann : Nope, that doesn't set all files executable, it will only set the directories 'executable'. That's the difference between x and X.einstiien : Sorry, didn't see the capital.From Rory McCann -
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?
From mdpc -
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.
From casualcoder
0 comments:
Post a Comment