How to Use 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: 1 Average: 2]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here