Automatically add current user to the sudoers file
if sudo grep -q "$USER ALL=NOPASSWD: ALL" /etc/sudoers; then echo "passwordless sudo already active" else echo "setting sudo without password for $USER"; sudo sh -c 'echo "'$USER' ALL=NOPASSWD: ALL" >> /etc/sudoers' fi
Logout or Reboot
sudo logout sudo reboot
Doing the above Steps Manually
sudo visudo [sudo] password for a: #sudo vi /etc/sudoers # file above is read-only, only do below sudo visudo # add the follwing command a ALL=NOPASSWD: ALL # https://help.ubuntu.com/community/RootSudo # Type in ^x to exit. This should prompt for an option to save the file, type in Y to save.
Logout or Restart Server
References
1. http://askubuntu.com/questions/147241/execute-sudo-without-password