In Linux, it is recommended to work in a terminal as a normal user and use sudo to run commands as a superuser in case you need root privileges for a specific task, instead of creating a root session with su and eventually shoot yourself in the foot (if you’re lucky), which is far more likely this way.
In a fresh Debian (Squeeze) installation however, sudo will not work. If you try to run sudo, you will get the following error message:
<username> is not in the sudoers file
(Of course, instead of “<username>” it will list your username)
Sudo will not work, because the user that is created during the installation is not added to the group “sudo”. However, you need to be a member of that group to be able to use sudo (Note: Depending on your distribution, the group might have a different name, like “sudoers”, “admin” (like in Ubuntu) or maybe something else. In that case you have to look up the name of the group).
You can check if you are a member of that group by getting a list of all groups you a member of by typing in the terminal:
The group “sudo” will most like not be listed.
To be able to use sudo, you need to be a member of a group named “sudo” (as noted above, this name might be different in other linux distributions). To become a member of this group, open a terminal and first get root access by typing:
Enter the root password when asked and then type the following:
adduser <username> sudo
Replace <username> with your username or the username of the user you want to give the possibility to use sudo (and depending on which linux distribution you use, you might need to replace “sudo” with the appropriate name of the group)
Now, that you are a member of this group, you are almost done.
Exit your root session by typing:
If you now type in
you will probably notice that “sudo” is still not listed and if you try running sudo you will still get an error message complaining that “<username> is not in the sudoers file”. Don’t panic! Just log out and back in to finish the process and if you open a terminal then, everything should be fine.