sudo without a password

If you are tired of typing your password all the time and want to be able to sudo without using a password you can modify the sudo configuration so that you can always execute a command as root without a password.

Method 1 - For a single user

Edit the /etc/sudoers configuration file.

Add a line like this replacing the with the correct user of course

ALL=(ALL) NOPASSWORD: ALL

Method 2 - For multiple users

Create a new group on the system eg sudo or sudoers nu using the following command. You should be aware that most systems now already have a group setup to do this so you may be able to skip creating the group.

groupadd sudoers

Then add the usernames you want it to work for by using the following command

addgroup yourusername sudoers

Edit the /etc/sudoers configuration file and add the group and tell sudo not to prompt for a password

%sudoers ALL=(ALL) NOPASSWORD: ALL

The above should work on debian / ubuntu and should only be used for trusted users as you have just given them root access without a password so some care should be taken!



Did You find this page useful?

Yes No



Last Modified: 02 May 2017

Releated Posts


2017-09-02 - Raspberry PI - Router Guide
2013-03-01 - Linux - What and how to kill a zombie process
2013-02-14 - Linux - Getting sshfs to work
2012-12-12 - Linux - List / Copy group membership for users
2012-12-08 - Linux - ssh key authentication
2012-12-04 - Linux - sudo without a password
2012-10-13 - Rasberry Pi - Alternative method to play video without omx gstreamer element
2012-10-10 - How to run tcpdump as root
2012-07-13 - Linux - Killing all processes for a specific user
2012-04-05 - Using gdb to debug a core file
2012-01-16 - Linux - Color Coding The Bash Prompt
2012-01-14 - Linux - Automatically set the DISPLAY environment variable in SSH connection
2012-01-06 - Adding extra swap space to linux