I have a fresh Arch Linux VM which I just set up. Everything works great with it. sudo
is also configured and works fine. Now I cloned my VM and changed the username and home directory of my normal user using these commands:
su
usermod -d /home/newname -m oldname
usermod -l newname oldname
groupmod -n newname oldname
reboot
I also changed the passwords of all users (including root) using passwd
.
The group name was the same as the user name. I got no errors, but after logging into my user I cannot use sudo anymore. I opened /etc/sudoers
and changed
oldname ALL=(ALL) ALL
to
newname ALL=(ALL) ALL
and rebooted again. I still cannot use sudo
anymore. It asks me for a password, but it reports Sorry, try again.
, always.
I also tried to repair sudo
doing:
su
pacman -Rsn sudo
pacman -S sudo
reboot
Still no luck. The password is right, because su
still works. How can I fix this issue?
newname
's password forsudo
rather thanroot
's, aren't yousudo
, the current user's or the target user's? By default, you need the current user's passwd, whereassu
asks for the target user's. This can be changed with thetargetpw
option in thesudoers
file.sudoers
file, entirely, to avoid such an issue. I was assuming it wants my root password, when I haven't configured it properly. If you provide an answer about the required steps allow anybody to use sudo with the root password, I can mark it accepted. In any case, this was the issue and with your help I was able to resolve it.