How to execute sudo without password prompt
When working in development environments it is pretty annoying that sudo
tasks require you to enter your password. But this behaviour can be disabled very easily with editing the file /etc/sudoers
.
We open the sudoers
-file using the visudo
command: sudo visudo
.
This opens a nano
editor, which checks the file contents on syntactical correctness when you try to save it and therefore preventing you from corrupting your system.
After opening the file with visudo you simply add the following line at the end of the file:
$USER ALL=(ALL) NOPASSWD: ALL
Please replace $USER
with your own username, that should be able to execute sudo
without a password prompt.
Finally you have to save your additions and close the sudoers file. For this press CTRL + X
and Y
. Hit Enter
to leave nano
.
>>> /etc/sudoers: syntax error <<<
Simply type
e
to edit the sudoers
-file again or x
to quit without saving your changes. After this you should be able to execute sudo
commands with being asked for your password.