grant user access to directory

AXISHK
AXISHK used Ask the Experts™
on
After creating a new user, how to grant the user to have

1. r/w access to a particular sub directory
2. r/w access to a directory and all files and sub directories under it
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2004
Commented:
It depends on how much access you want to grant to other users as well.  The basic permissions in Linux are user, group, and other (world).  The user level is for the owner of the resource, the group level is for the group owner, and other is everyone else.  The levels themselves are bit flags:

1 = execute
2 = write
4 = read

So, if you want the owner to have all permissions, the group to have read and write, and everyone else to have only read, you would set the permissions as 764.

You can use http://linux.die.net/man/1/chownchown to set the owner of a resource, and chmod will change the permission levels.  The -R option with each of those will execute the command recursively, meaning down into subdirectories and their contents.

Author

Commented:
Tks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial