Debian - Make user sudo - Root password not working on new install

# Debian - add a user to the sudo group:
su
/usr/sbin/usermod -aG sudo <username>
Or:
/sbin/usermod -aG sudo <username>


Note: using su instead of sudo requires the full path to usermod since sbin is not in the path with this method, that is why it is there.

Note: using adduser <username> sudo only seem to work on Debian, but it does not work anyway.

# in Ubuntu:
su
adduser username sudo

Note, a _full_ logout of the user must be done as /etc/sudoers seems to be edited upon login. It is not enough to make a new shell.

# in Slackware (12):

Edit /etc/sudoers, uncomment the following line:
# Uncomment to allow people in group wheel to run all commands
# %wheel  ALL=(ALL)       ALL

So it looks like this:
# Uncomment to allow people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

Save the file. Then add the user to the wheel group:
gpasswd -a username wheel

Note that usermod "-a" does not exist in Slackware 12.



Debian 11 - Root password not working on new install


On a new encrypted install of Debian 11 I could not get root access with the installation username password.

su denied the installation user password that usually is the root password.

It turned out that no password for root was set.

To set it, as the regular user used to install run this:

sudo passwd root

Enter the password for the user, then enter the desired root password twice.

Note that this is permitted even if you usually need to add the user to the sudoers group first.

This is a personal note. Last updated: 2022-02-03 18:07:42.



GitHub

My

GitLab

My

LinkedIn

My

Klebe.se

Don't forget to pay my friend a visit too. Joakim