1. sudo vim /etc/systemd/logind.conf
修改代码KillUserProcesses=yes
2. sudo touch /etc/polkit-1/localauthority/50-local.d/multi-user-inhibit-shutdown-restart.pkla
3. 打开修改配置文件
sudo vim /etc/polkit-1/localauthority/50-local.d/multi-user-inhibit-shutdown-restart.pkla
[multi-user-inhibit-shutdown-restart]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off-multiple-sessions;
ResultActive=auth_admin