How to disable password prompt for “sudo” users

The passwords are for security but sometimes they become annoying to you may want to disable password prompt for sudo user because you have already setup key based authentication or you don’t want system to ask for password once you successfully login to it. Following is how you can disable sudo password prompt.

Edit the /etc/sudoers file.
you can edit it using visudo command which is considered to be the safe and secure way to edit /etc/sudoers file.

$ sudo visudo

OR you can directly edit /etc/sudoers file using Vim editor but for this you need to change the file permissions which is not recommended.

$ sudo vim /etc/sudoers 

 once the file is in edit mode you need to add following line and save it.

user_name ALL=(ALL) NOPASSWD: ALL

disable-sudo-user-password-prompt
disable-sudo-user-password-prompt

when opened with visudo press Ctrl+x then type y and press enter to save.

Once file is saved user will be able to use sudo without a password prompt you can quickly verify it by creating a file.

$ sudo touch file1

Thats it, now the  commands executed with sudo will not asking for password. Let us know in the comments if it worked for you or even if you faced any issues  / errors.


1 Reply to “How to disable password prompt for “sudo” users”

Leave a Reply

Your email address will not be published. Required fields are marked *