John Powel
John Powel

Reputation: 1424

Grant permissions/change owner to a user

I have a a two folders /opt/tom and /opt/test/ that has the following permissions:

drwxr-xr-x. 2 root root 4096 Apr  2 16:23 tom
drwxr-xr-x. 2 root root 4096 Apr  2 16:16 test

how can I grant the permission to a user called john so that it looks like this?

drwxr-sr-x 3 john root 4096 Dec  5 13:22 tom
drwxrwxrwx 3 john root 4096 Apr  1 16:45 test

Upvotes: 0

Views: 321

Answers (1)

Piotr Zierhoffer
Piotr Zierhoffer

Reputation: 5151

To change a user, you use (as root or with sudo):

chown john tom test

To set the rights:

chmod 777 /opt/test
chmod 2755 /opt/tom

(2 will set SGID bit)

You can always add -R switch, so it will be a recursive change. It's worth adding, that usually setting SUID/SGID bits for a directory makes new files created in this directory inherit this options.

Upvotes: 1

Related Questions