jump to navigation

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

Comments»

1. teknokool.net » links for 2006-03-22 - March 22, 2006

[…] Ubuntu Blog » Disable Shutdown For Normal Users (tags: ubuntu) […]

2. adam - September 23, 2006

thanks – good tip -stopped my six year old children shutting my machine down.

3. Diego2k - May 9, 2007

Hi i’m trying to find a way to allow a user to shutdown -P now from an script …

Any idea?

4. carolinason - May 10, 2007

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

5. jh - August 22, 2007

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–

6. miksuh - August 31, 2007

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”

7. miksuh - August 31, 2007

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

8. miksuh - August 31, 2007

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.

9. miksuh - August 31, 2007

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.

10. car insurance west - October 22, 2008

car insurance west…

Walden Franz billiards widowed!gulls reaped….

11. best bonus bingo - October 29, 2008

best bonus bingo…

Baptists lengths,nets parameterless assigned amenorrhea …

12. escort bayan - February 27, 2010

thanks so much all admin

13. Tom - May 18, 2010

Hi,

does not work clear at Lucid Lynx only shutdown is hidden
reboot it still available, gdm is replaced to xdm

14. porno sikiş - September 27, 2010

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.

15. sex sikiş - September 28, 2010

Step 5 doesn’t work anymore. To get to the configuration editor, type gconf-editor to a shell prompt.

16. recording studio kent - January 13, 2011

this is a great post thanks mate

17. arkadaş - August 6, 2011

teşekkür ederim paylaşım için çok faydalı oldu

18. antalya böcek ilaçlama - August 8, 2011

antalya ev ilaçlama

19. How to prevent normal users from shutting down the system? - Admins Goodies - August 22, 2011

[…] is generally the norm for most systems, but Ubuntu is a bit different. Here is an article with all the steps for […]

20. Viktor Dick - October 11, 2011

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).

21. Edward - October 12, 2011

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.

22. auto insurance company ratings - June 4, 2013

This is my first time pay a visit at here and i am really
impressed to read everthing at one place.

23. How to prevent normal users from shutting down the system? - Just just easy answers - September 6, 2013

[…] is generally the norm for most systems, but Ubuntu is a bit different. Here is an article with all the steps for […]

24. Princess - January 6, 2015

Today i spent 300 bucks for platinium roulette system ,
i hope that i will make my first money online


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: