2013-04-02 72 views
0

我有两个文件夹/opt/tom/opt/test/具有以下权限:授予权限/所有者更改为用户

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

我怎么能授予权限到一个名为john,使它看起来像这样的用户?

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

在您的示例中,您向用户授予权限,而不是授予组。 – Barmar

+0

@Barmar,刚刚更改 –

+0

更新了我的答案以适合您的修改。 –

回答

1

要更改用户,可以使用(以root或sudo):

chown john tom test 

要设置权限:

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

(2将设置SGID位)

您可以随时添加-R开关,因此这将是一个递归更改。值得添加的是,通常为目录设置SUID/SGID位使得在此目录中创建的新文件继承此选项。

+0

非常感谢! –

+0

很高兴帮助:)如果你喜欢这个答案,你总是可以赞成它;-) –