關閉圖形界面下普通用戶關機重啟命令- 7.x - CentOS
阿新 • • 發佈:2018-08-09
admin cal 重啟 oca cati 用戶 關閉 關機 allow
vim /etc/polkit-1/rules.d/55-inhibit-shutdown.rules
polkit.addRule(function(action, subject) { if (action.id.indexOf("org.freedesktop.login1.power-off") == 0 || action.id.indexOf("org.freedesktop.login1.reboot") == 0) { try { // user-may-reboot exits with success (exit code 0) // only if the passed username is authorized polkit.spawn(["/usr/local/bin/user-may-reboot", subject.user]); return polkit.Result.YES; } catch (error) { // Nope, but do allow admin authentication return polkit.Result.AUTH_ADMIN; } } });
chmod 755 55-inhibit-shutdown.rules
不用重啟,命令就會運行
關閉圖形界面下普通用戶關機重啟命令- 7.x - CentOS