How to set up sudo on Debian GNU/Linux

If you just installed Debian, you might notice that one Linux staple, sudo is not installed by default. Here is the quick way to add it, and set yourself up as an administrative user.

1. Install sudo, using the su command to elevate privileges.

bob$ su
Password: 
root# apt-get install sudo

2. Make yourself an administrator. The default /etc/sudoers file contains this line:

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

So simply add your account (‘bob‘ in this example) to the sudo group:

root# usermod -a -G sudo bob

3. Log out and back in again, in order to apply changes to your group membership.

bob$ groups
bob cdrom floppy sudo audio dip video plugdev netdev lpadmin scanner bluetooth
bob$ sudo echo test
[sudo] password for bob: 
test

Leave a Reply

Your email address will not be published. Required fields are marked *