I am looking for a terminal command to shutdown without having to write down my password and without installing any extra programs.

As when clicking the shutdown button, why it is not asking me for the password and a program like gnome-pie that shutdown without asking me for the password and without confirmation.

I want this command as I am a Java programmer and I want to make use of it.

  • Google "sudo shutdown" and "sudoers"
    – Boris Bukh
    Commented Dec 8, 2011 at 14:05

3 Answers 3


You will need to add command alias for all related command as follows:

Cmnd_Alias SHUTDOWN_CMDS = /sbin/shutdown, /sbin/halt, /sbin/reboot

and after that you need to add a user specification as follows at the end of /etc/sudoers file


You will need root permissions to write to sudoers file.

This is from ubuntu community documentation at https://help.ubuntu.com/community/Sudoers#Shutting_Down_From_The_Console_Without_A_Password


You could make your 'sudo' work without a password.


Add to end of the file...

your_user_name ALL = NOPASSWD: ALL

Save. Log out. Log in. Now you can shutdown/reboot without a password. But I think you want this link instead: How can I make shutdown not require admin password?.

  • 1
    I dont think that removing password for all commands is a good idea. It will have almost all the same disadvantages/problems that logging as root user has. I would recommend creating an alias for all related commands and using NOPASSWD for that alias only.
    – binW
    Commented Dec 8, 2011 at 14:39

Assuming you want to run the commands under an X session:

Under UPower (Ubuntu 10.04+)

to suspend:

dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

to hibernate:

dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

You can find more info at: https://wiki.ubuntu.com/DebuggingGNOMEPowerManager

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .