Ubuntu – How to shutdown/restart/suspend … without authentication or confirmation

11.10command linejavaprogrammingshutdown

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.

Best Answer

  • 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

    <your username> ALL=(ALL) NOPASSWD: SHUTDOWN_CMDS

    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