如何禁止某些使用者執行 su?
首先建立一個群組 nosu (或 blacklist 等,請自行命名):
groupadd nosu
此時在 /etc/group 內會出現類似下行的資訊 (gid 會因機器而異):
nosu:x:512:
編輯 /etc/group,把欲禁用 su 的使用者加入 nosu 這個群組, 例如把 john 與 qoo 列入禁用的範圍:
nosu:x:512:john,qoo
把 /bin/su 的群組改成 nosu,並移除群組的權限:
chgrp nosu /bin/su
chmod g= /bin/su
對 /bin/su 執行 ls -l,若權限與群組與下圖相同即告完成:
-rws---r-x 1 root nosu 18452 7月 24 2001 /bin/su