advertisement

2015年8月2日

Disabling shutdown command for users 禁止一般使用者關機 linux kde

最近玩server發現一件嚴重的事情!!

一般使用者竟然可以執行
$ /sbin/shutdown -h now

Solution:
# ls -l /sbin/shutdown
lrwxrwxrwx 1 root root 14 May 26 14:07 /sbin/shutdown -> /bin/systemctl
# ls -l /bin/systemctl
-rwxrwxrwx 1 root root 538904 May 26 14:07 /bin/systemctl
# chmod 755 /sbin/shutdown
# ls -l /bin/systemctl
-rwxr-xr-x 1 root root 538904 May 26 14:07 /bin/systemctl

# vi /etc/kde4/kdm/kdmrc
搜尋所有AllowShutdown=ALL
改成AllowShutdown=Root