Tired of sudo asking for your password? Yes! This gets kind of annoying when I'm the only user of this computer - Antonino Arcud provided help.
I am tired of sudo asking for my password everytime I need to install a package with apt or aptitude. Someone could say this is the B-side of security, but not enough for me to justify it (and I’m the only user of this pc). So, even if someone could define this insane or unsafe, here there is a way to avoid that epic question.
Keep your eyes open and your fingers ready, you can make a disaster if don’t!
Now that I’ve washed my hands, let’s keep going with the stuff. The configuration’s file we need to modify is /etc/sudoers , and no, we can’t do it with gedit/kate/nano… We need to use visudo, as written in the first line of that file. So we need to open a terminal and launch sudo visudo (and, obviously, insert the password when asked). Now scroll until the line:
# User privilege specification
root ALL=(ALL) ALL
elwood ALL=(ALL) ALL
and add a new line like this: you-user localhost = command you need . For me it’s as follow
elwood localhost = NOPASSWD: /usr/bin/aptitude /usr/bin/apt-get
Save and exit with ctrl+x and from next login sudo will stop prompting for the password. Other commands, if needed, can be addedd at the end of the line without writing a new rule. For other uses and more about setting this permissions just read man sudoers