su-up!

So, I finally got sick of typing my root user password in my Windows Subsystem for Linux (WSL), *nix Docker containers and Linux servers…

The answer (for some flavours of *nux): just create an addendum to /etc/sudoers by creating any new file in the /etc/sudoers.d/ directory!

Very simply:

  • create a new file (e.g. sudoers) (I assume you know how to use vi, else just replace vi with text editor of choice as available!)
sudo vi /etc/sudoers.d/sudoers
  • add the following line, replacing <user> as with the user name, then save and quit
<user> ALL=(ALL:ALL) NOPASSWD:ALL

Disconnect, re-connect with non-root account, type sudo bash and root away!

2021/07/21 Update: If you are not a masochist, use visudo – it parses the edits on exit and spits it back at you if there are any syntax/parsing errors.

Leave a Reply