In this tutorial you will learn how to configure sudo without the password. Meaning that the sudo command will not prompt you to enter password hence rendering your sudo command completely passwordless.
Configuring your
sudo command with no password may lead to a security breach, hence leaving your system and data compromised. You are adviced not to proceed with sudo passwordless configuration!In this tutorial you will learn:
- How to disable sudo password for the
sudocommand - How to disable sudo password for a specific administrative commands
Software Requirements and Conventions Used
| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa |
| Software | N/A |
| Other | Privileged access to your Linux system as root or via the sudo command. |
| Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Configure sudo without password on Ubuntu 20.04 step by step instructions
- First you might want to consider to disable sudo password only for a selected administrative command(s). To do so you need to edit the
/etc/sudoerssudo configuration command using thesudo visudoeditor.For example to allow a single user eg.
linuxconfigto execute thesystemctlandrebootcommands without sudo password add the following line into the/etc/sudoersconfiguration file:linuxconfig ALL=(ALL) NOPASSWD:/usr/bin/systemctl /usr/sbin/reboot
At this point executing the
systemctlandrebootcommands will not requiresudopassword. - Next, if you wish the
linuxconfiguser to execute all commands using sudo with no password change the configuration line fromStep 1 to:linuxconfig ALL=(ALL) NOPASSWD:ALL
- Lastly, in case you need all members of the sudo group to execute any commands using passwordless sudo, change the configuration line from
Step 1 to:%sudo ALL=(ALL:ALL) NOPASSWD:ALL
