Skip to main content

How to Use Sudo On Debian

sudo on debian

When installing Debian on your system, the installer creates two user accounts: root and a standard account. By default, the standard user account can not use sudo command to do administrative tasks although this user can use su to login as root.

User is not in the sudoers file

If the standard user execute a command with sudo, the user will be notified that he/she is not in the sudoers file and this incidident will be reported to root user.

is not in the sudoers file

How to Assign Sudo Privileges to Standard User

In order to allow standard users to use sudo, we need to add this user to the sudo group. You can check whether a user belongs to sudo group by running the groups command.

groups command

As you can see, user xiao is not in the sudo group. To add a user to the sudo group, login as root.

su -

Then use this command to add use to sudo group. Replace <username> with your real username.

adduser <username> sudo

After that, you need to log out of the current session and log back in. Then open a terminal window and issue groups command again. You will see the user is now in the sudo group.

user in the sudo group

And the user can use sudo to do administrative tasks.

sudo apt-get update
Rate this tutorial
[Total: 0 Average: 0]