How to Configure Passwordless ‘sudo’ on Linux
Set up passwordless sudo for admin users for easier operations on remote servers
Many deployment tools (including Mirantis Launchpad) do their work by emulating a user (or root) — logging into remote servers using SSH, and issuing commands.
A secondary requirement (true in Launchpad’s case as well) is ‘passwordless’ access to sudo: the command administrative users are empowered to issue to temporarily assume root-like privileges.
Passwordless sudo access for administrative users is enabled by default for Linux VMs on many cloud platforms. If you’re creating servers or VMs on other platforms (e.g., VirtualBox), you’ll need to enable passwordless sudo as part of initial configuration.
Only one step is required, here. We’re using Ubuntu Server as an example:
Step 1: Enable passwordless sudo for the administrator
First, SSH to your server. In many cases, you’ll have made this ‘passwordless’ as well, so you’ll use your private key:
ssh -i ~/.ssh/id_rsa <user>@<ip_address>
Then start the visudo program (you’ll need to provide your password to make sudo work):
sudo visudo
At the bottom of this file, add the line:
$USER ALL=(ALL) NOPASSWD: ALL
The expression $USER denotes a shell variable automatically set to contain the current user’s username.
Save and exit. Then log out of the machine and back in. You should be able to perform sudo actions without providing your password.