Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm using a desktop as both a router for my local network and as a normal desktop with multiple users. I have Maverick running on it. Occasionally, one of the desktop users will accidentally press Shutdown, Restart, Suspend, or Hibernate, leading to me having to fix the network at random times of day. I know how to restart and shutdown from the command line. I do not need the GUI interface.

How can I remove the Shutdown, Suspend, Restart, and Hibernate options form the user switcher menu? All the I want left is the "Lock Screen", "Guest Session", List of users and "Logout" left.

A system wide solution would be best, but I can do one on each user if necessary.

share|improve this question
    
If you do find away to just take those options out of the gui . Then it would cure your issue. But It will be very tedious and risky. What i would be afraid of is making this change and leaving the system unable to restart even from the command prompt. –  freebird Jul 16 '11 at 6:34
    
@freebird I'm sorry but I can't agree with your comment. A GUI option to shutdown isn't mandatory. Servers, mostly, don't run a desktop env like GNOME and can restart at will –  sergio91pt Jul 16 '11 at 9:21
add comment

2 Answers

up vote 3 down vote accepted

Option 1:

Install gconf-editor, run gksu gconf-editor and on /apps/indicator-session/ supress the restart and shutdown.

I'm not sure about suspend and hibernate, maybe changing <allow_active> to no on /usr/share/polkit-1/actions/org.freedesktop.upower.policy will do the trick.


Option 2:

Remove the Indicator session package and add desktop shortcuts to logout and locking the screen.

The command to logout is gnome-session-save --logout-dialog and to lock the screen use gnome-screensaver-command --lock.

share|improve this answer
1  
The first option works. I'm not sure if you can still suspend or hibernate from the CLI with it, but that doesn't really matter on this machine. Thanks! –  Azendale Jul 16 '11 at 16:49
add comment

For suspend and hibernate, instead of editing a package file that will be replaced when the package is updated, one can use files in /etc/polkit-1/localauthority. Disable suspend with the file /etc/polkit-1/localauthority/90-mandatory.d/disable-suspend.pkla containing :

[Disable suspend]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no

This is inspired by the file /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla containing, among other things, the configuration to disable hibernation :

[Disable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=no

At least, it's what I use on Ubuntu 12.04.

More on PolicyKit local authority: http://hal.freedesktop.org/docs/polkit/pklocalauthority.8.html

share|improve this answer
    
Does not work in 13.10 –  Takkat Mar 30 at 11:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.