I know I am…
Invariably when I log into one of my linux servers over an SSH terminal, I end up wanting to modify some files that require root permissions. So I insert the necessary
sudo command at the front of the line and proceed. However, I tend to use randomized passwords and it’s always a pain to look them up.
For this brief note, I’m using an Ubuntu v18.04.4 linux server. If you want to check your operating system version in linux, just execute the following command:
You should see some output such as:
VERSION="18.04.4 LTS (Bionic Beaver)"
PRETTY_NAME="Ubuntu 18.04.4 LTS"
Now whenever I am working with a new server, I setup a non-root user as best practice, which is why I end up getting prompted to enter a password whenever using
sudo. For this example, let’s pretend our username is
bobrobot. What we need to do is add a line into a file located at
/etc/sudoers that allows
bobrobot to execute
sudo (i.e. superuser do) without being questioned.
Go ahead and choose your favorite text editor (e.g.
nano) and open up this file:
sudo vim /etc/sudoers
You should see a comment near the bottom of this file that looks like
Directly below this line, go ahead and insert the following (using your username instead of
bobrobot ALL=(ALL) NOPASSWD:ALL
Save and exit the file. You may need to logout and back in before the changes come into effect. That’s it!