Sudo user in Debian

Install the “sudo” Command
You need to run this command as root user:

user@debian:~$ su -
root@debian:~ # apt-get install sudo

Create a new user account.

#/usr/sbin/adduser admin

Add the user to the sudo group; By default on Debian systems, members of the group sudo are granted with sudo access. To add a user to the sudo group use the usermod command:

#usermod -aG sudo admin

Check the sudo access

#id admin
uid=1001(admin) gid=1001(admin) groups=1001(admin),27(sudo)

The user admin a member of sudo group now and to work as a root, every command must start with sudo (sudo reboot, sudo vim, sudo del, sudo mkdir, sudo……)

Error and solutions

admin@debian9:~$ sudo ifconfig
sudo: unable to resolve host (none)


Insert hostname to /etc/hostname and /etc/hosts something like:    localhost.localdomain localhost    debian9

Leave a Reply

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