Add Sudo to Debian/Ubuntu
I was surprised, when I learnt that sudo doesn’t come installed by default. I had to go and look up how to get it installed, and configured.
I like sudo
. When I type sudo, it’s a strong message that I’m doing something that could have consequences for the entire system. The alternative is execute commands logged in as a superuser. I can’t handle that much power.
Here’s how.
- Log in as a superuser…
su -
- Update the package repository. Always good practice before installing something new:
apt-get update
- Install sudo using the package manager:
apt-get install sudo -y
- Add your regular user account (eg. timothy) to the sudo group:
usermod -aG sudo timothy
- Logout from your superuser terminal…
exit
- Confirm user is added to the sudo group:
id timothy
- Create a new terminal and test the new functionality:
sudo -s
(BONUS) Remove password prompt from sudo’d commands:
- Add new line to sudo config file:
echo "timothy ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers