Disable Shutdown For Normal Users March 20, 2006
Posted by Carthik in administration, guides, ubuntu.trackback
Sometimes, when you have one computer shared among multiple users, and you don’t want normal users (users who are not admins), that is, anyone who is not you 😉 to be able to shutdown the computer, then you can follow the following steps. Some of this is from the useful fedora mailing list email, and some from the ubuntu-users mailing list (thanks to Olafur Arason). I tried the instructions below on my computer, and this should work for you.
Again, this will allow only admin users with sudo privileges to shutdown the computer, for other “normal” users, the logout menu will allow them to do only that, log out!
Step1:
Open /etc/X11/gdm/gdm.conf
in a text editor and find the [greeter] section. Make sure that there is a line which says SystemMenu = false
. This line will ensure that the gdm login screen will not have the option for shutting down the system etc.
Step 2:
If you have a laptop, or an acpi system on your computer, then go to /etc/acpi
and disable the power button, so that, when someone presses the power button, the system does not shutdown. You can disable this easily by doing chmod 000 /etc/acpi/powerbtn.sh
Step 3:
Now edit /etc/inittab
and find the lines that say:
#Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
And change it to read:
#Disallow CTRL-ALT-DELETE
.
ca::ctrlaltdel:/bin/echo "ctrl-alt-delete has been disabled"
This will effectively prevent users from changing to a console screen and using ctrl+alt+delete to shutdown the system.
Step 4:
Execute the following commands:
sudo chgrp admin /sbin/halt /sbin/shutdown
sudo chmod 550 /sbin/halt /sbin/shutdown
Step 5:
Use the Configuration Editor (Applications -> System Tools -> Configuration Editor) to edit the preference apps->gnome-session->options->logout_option to “logout” instead of “shutdown”.
That’s it! Now only you, or another superuser (Admin) can shutdown the system, using the command:
$sudo shutdown -t3 -r now
[…] Ubuntu Blog » Disable Shutdown For Normal Users (tags: ubuntu) […]
thanks – good tip -stopped my six year old children shutting my machine down.
Hi i’m trying to find a way to allow a user to shutdown -P now from an script …
Any idea?
This is all good, but is there a way to have the exit panel show shutdown and restart for certain users and not for others? Without having to use the shell. Also
$sudo shutdown -t3 -r now
doesn’t shutdown the system, well it does, but it
FTMP – Requests that the system be rebooted after it has been brought down.
$sudo shutdown -t3 -H now
FTMP – Requests that the system be halted after it has been brought down.
-thanks
Step 5 doesn’t work anymore. To get to the configuration editor, type gconf-editor to a shell prompt.
However, the default is already “logout”, yet today someone shut down my machine by going to the log out button on the panel and selecting the shutdown option when the window with options appeared. How can I disable that? That icon isn’t even putting up a corresponding process, so I don’t know what program is actually running. The icon has no preferences nor does the panel have any relevant ones. Clearly it must be using some set-uid program or a /proc-type of file. Which, and how to turn it off?
Thanks,
–jh–
You don’t need to disable CTRL-ALT-DELETE completely. You can control it who can reboot using that key combination. I use Debian Etch, but this should work no matter what distro you use.
Edit the file /etc/shutdown.allow, create it if it does not exist. Each line in that file should contain only the username of user who is allowed to reboot.
Next you might need to change /etc/inittab. Make sure that there is an option -a in this line (In Debian Etch this is default):
#Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t1 -a -r now
Now only root and users listed on /etc/shutdown.allow can reboot using CTRL-ALT-DELETE. Others will get message: “shutdown: no authorized users logged in”
Well actually this is default line in Debian Etch
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
But anyway what matters is that option -a
This also works if noone is logged in. If you leave /etc/shutdown.allow empty only root can reboot using CTRL-ALT-DEL. But you need to have that file, even if it’s empty, otherwise -a will be ignored.
Hmm.. Looks like /etc/shutdown.allow can’t be used in Ubuntu 😛
https://bugs.launchpad.net/upstart/+bug/107469
I did not know that because I don’t use Ubuntu.
car insurance west…
Walden Franz billiards widowed!gulls reaped….
best bonus bingo…
Baptists lengths,nets parameterless assigned amenorrhea …
thanks so much all admin
Hi,
does not work clear at Lucid Lynx only shutdown is hidden
reboot it still available, gdm is replaced to xdm
Edit the file /etc/shutdown.allow, create it if it does not exist. Each line in that file should contain only the username of user who is allowed to reboot.
Step 5 doesn’t work anymore. To get to the configuration editor, type gconf-editor to a shell prompt.
this is a great post thanks mate
teşekkür ederim paylaşım için çok faydalı oldu
antalya ev ilaçlama
[…] is generally the norm for most systems, but Ubuntu is a bit different. Here is an article with all the steps for […]
I have set up a computer in a separate room, so that the users can only access the mouse, the keyboard and the monitor. Thus Step 2 can be skipped, but I have a problem with Step 5 – this is done in the user configuration, so the user can also circumvent it. Is there a better solution?
I wonder how one can configure that CTRL+ALT+DEL only works for certain users – usually it even works on ttys where no login prompt is running, except on ttys with X. I’ll have to test this one. As a temporary workaround I will create a dummy user and log him in/lock the screen when I start the computer, so no one can shut it down (together with Step 1).
What I need is to keep the power off button enabled on the login screen (GDM) but no power off option from a user session, I mean, there must be no option for shutdown/suspend/hibernate on the logout menu/button.
Sometimes, people click on the wrong place and shutdown, suspend or hibernate the computer by mistake when they’re trying to logout. I want to avoid that by forcing the user to logout first and then power off as a separate action to be done only if it is really necessary.
This is my first time pay a visit at here and i am really
impressed to read everthing at one place.
[…] is generally the norm for most systems, but Ubuntu is a bit different. Here is an article with all the steps for […]
Today i spent 300 bucks for platinium roulette system ,
i hope that i will make my first money online