我记得在9.04左右的ubuntu版本中,如果有其他用户登录,可能会禁用用户关闭系统(甚至可能也挂起),例如policykit之类的东西。
在11.04中可以做吗?
谢谢
编辑:
如果有人需要(出于自担风险),则/ usr / lib / pm-utils / bin / pm-action中的少量更改将允许用户在只有用户登录的情况下或者当用户将运行sudo pm-suspend时挂起计算机。可能不是最好的代码,但目前可以使用。
diff -r 805887c5c0f6 pm-action
--- a/pm-action Wed Jun 29 23:32:01 2011 +0200
+++ b/pm-action Wed Jun 29 23:37:23 2011 +0200
@@ -47,6 +47,14 @@
exit 1
fi
+if [ "$(id -u )" == 0 -o `w -h | cut -f 1 -d " " | sort | uniq | wc -l` -eq 1 ]; then
+ echo "either youre root or root isnt here and youre only user, continuing" 1>&2
+ else
+ echo "Not suspending, root is here or there is more users" 1>&2
+ exit 2
+ fi
+
+
remove_suspend_lock()
{
release_lock "${STASHNAME}.lock"
问题仍然存在,当有多个用户登录时(不重写pm-suspend或暂停(或其他黑客)),是否可以禁止关闭或暂停?
/var/lib/polkit-1/localauthority/*.d按照pklocalauthority手册页中的说明在一个目录中设置策略文件。避免修改包安装的文件(如/usr/share/polkit-1/actions/org.freedesktop.consolekit.policy),而不是中的配置文件/etc/。