I have just set up a new PC with a fresh debian 9.0.1 iso. The system is running fine but the su command does not work.
user@debian:~$ su
Password:
su: Authentication failure
I reinstall system several times and test all install options (graphical install, expert install, lvm, standart partition ...) but I always encounter this issue with the su command.
I am sure of my password, I choose ben as root password for testing purpose.
I am also sure of my keyboard layout.
I am totally blocked since the sudo command is not configured by default on debian 9.
How can I fix that?
3 Answers
Had the same thing; solved it like this:
In your grub menu, select your Debian install and press 'e' to edit the kernel arguments.
Find the line starting with linux and add init=/bin/bash to the end of the line. Then start Debian with F10. You will see a terminal.
Mount the filesystem as read-write with:
mount -o remount,rw /
Change the password with the passwd command:
passwd root
Your root account might be locked. You can verify this via:
sudo passwd -S root
If in the output line root is followed by an L, the root account is locked.
You can set a new password for root via:
sudo passwd root
Afterwards, su should work.
Besides that, it is often recommended to use sudo -i or sudo su instead of su. For further information, have a look at the Debian Wiki:
When you exec su command you must provide the password of target user. In your case:
su
this is the root password. To exec the operation with your password you should use the command:
sudo su -
P.S. Use dash after su command to get the environment of target user