DISCLAIMER: This is definitely not recommended for any type of real environment that you rely on to be secure, but sometimes when you are setting up demo/sandpit/throwaway environments you want to be able to execute commands on Linux as root using sudo without getting prompted for your password. You could just work in a root shell all the time, but perhaps you still want to use sudo so you can use your normal account mostly and save yourself from potential accidents by only using sudo when you have to.
So, disclaimer out of the way, here’s how you can set yourself up as a no-password-sudoer (assuming you start out with sudo/root access to begin with):
Add your userid to an appropriate admin group:
sudo gpasswd -a youruserid youradmingroup
Edit the sudoers file:
sudo visudo
… to add an entry to allow your admin group to execute any command via sudo with no password requirement:
%youradmingroup ALL=NOPASSWD: ALL
BTW – visudo on Ubuntu defaults to the nano editor. If you prefer vi/vim you can switch default editor with:
sudo update-alternatives --config editor
.. and select the /usr/bin/vim.basic entry.
There’s more info about sudo on Ubuntu in the community documentation: RootSudo, Sudoers and RootSudoTimeout.
That’s it… sometimes handy but also dangerous … don’t say I didn’t warn you ;)