LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   disable shutdown, restart menu options (lightdm, pangolin) (https://www.linuxquestions.org/questions/ubuntu-63/disable-shutdown-restart-menu-options-lightdm-pangolin-943071/)

otoomet 05-03-2012 06:10 AM

disable shutdown, restart menu options (lightdm, pangolin)
 
Hey,
I have a ubuntu 12.04 box which is always on and acts both as my work computer and a server. I would like to disable shut-down, restart and related menu options to avoid users (including myself ;-) accidentally shutting it down. Only sudo shutdown... option should remain.

I cannot believe there is no straightforward possibility to achieve that, although google could not find anything useful.

L^2 10-07-2014 03:52 PM

Disabling shutdown controls in KDE
 
Apart from starting shutdown/poweroff/halt from a text terminal, the KDE
offers (at least?) two ways to shut the system down:

- menu options for leaving the KDE session
- menu options available from the KDM greeter (the login screen)

For the latter, there is a graphic utility available via Settings-System Settings-
Login Screen, Shutdown Tab. But, for those who need to set it at, say 50+ computers,
it is not the best way.

a) KDM greeter:
1. find the kdm configuration file, kdmrc. If the documentation is not helpful,
a package manager of your distro can be useful, e.g. for RH-alikes:
$ rpm -qa | grep kdm
kde-settings-kdm-20-17.fc20.noarch
kdm-4.11.12-1.fc20.x86_64
$ rpm -ql kde-settings-kdm | grep kdmrc
/etc/kde/kdm/kdmrc
2. Save a backup copy of it in some safe location.
3. Edit this file (as root); locate AllowShutdown keys - there should be two
such keys, one for the local console and the other for remote displays (e.g.
available via XDMCP). Set both the two to either Root or None.
4. Close your session and try to shut the system down from the login screen
using its controls. If it works as expected, copy the configuration file
to other computers.

b) to get rid of shutdown options in the KDE menu:
1. Find the configuration file kdeglobals - in a similar way
2. In the [Global] section, locate "offerShutdown" and set it to "false"

Note that these settings just result in removing controls and do not prevent turning the system off in other ways (e.g. by unplugging the cord :-) ). As far as KDE is regarded, there are may detailed shutdown options in the kdmrc file, such as "HaltCmd=/sbin/poweroff" or "RebootCmd=/sbin/shutdown -r now". You may redirect it, e.g. to a polite warning message.

While my answer regards KDE, I guess there should be similar settings for other dm's.


All times are GMT -5. The time now is 01:00 PM.