2013-04-02 75 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

很高興幫助:)如果你喜歡這個答案,你總是可以贊成它;-) –