4

I am a newb to Ubuntu/Linux. I am running Ubuntu 16.04.3 LTS with retropie. Whenever I try to shut down the system from retropie it always asks for a password and I have to plug in a keyboard and enter the password.

How do I disable the password request so I can shut down easily from retropie?

A simple step by step would be appreciated!

1
  • Are you using a terminal command to shutdown or a gui method? Would you edit your answer with how you are shutting down and any errors from commands you have run?
    – J. Starnes
    Nov 7, 2017 at 22:22

1 Answer 1

3

Edit your box's sudoers file. In a terminal run sudo visudo. visudo does a good job of limiting the damage that can be done by manual edits. Adding the following lines, replacing bob with the correct username. Running the above command with sudo requires the current user's password.

Cmnd_Alias SHUTDOWN_CMDS = /sbin/poweroff, /sbin/halt, /sbin/reboot
bob ALL=(ALL) NOPASSWD: SHUTDOWN_CMDS

If your system is not connected to the Internet in anyway, an alteritive is to change the line sudo ALL=(ALL) ALL to sudo ALL=(ALL) NOPASSWD: ALL. If connected to the internet this is risky.

The sudoers file alters sudo permissions to allow a specified user or group to run specific commands. In this case bob can run various shutdown commands without a password.

The /etc/sudoers file controls who can run what commands as what users on what machines and can also control special things such as whether you need a password for particular commands. The file is composed of aliases (basically variables) and user specifications (which control who can run what).
- Ubuntu Community Wiki - Sudoers.

5
  • That's not working.. Do I need to have root access? If so how do I get root permissions? Nov 7, 2017 at 21:49
  • OK found some corruption so reinstalled everything and that worked! Thank you !! Nov 8, 2017 at 18:00
  • If you would post an answer to your question stating the steps taken to resolve your problem, then mark the best answer as accepted others will be better able to find the solution.
    – J. Starnes
    Nov 8, 2017 at 19:18
  • Is there a reason why you did not add /sbin/shutdown to that alias? Mar 10, 2019 at 17:56
  • I was not trying to make a comprehensive alias just a function example. When you find questions and answers that can be improved all users even unregistered users are encouraged to improve them by editing. Feel free to submit an edit to include the additional alias.
    – J. Starnes
    Mar 11, 2019 at 5:17

You must log in to answer this question.

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