0

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?

3
  • 2
    You are using newname's password for sudo rather than root's, aren't you Feb 23, 2021 at 23:47
  • 1
    Which password do you enter with sudo , the current user's or the target user's? By default, you need the current user's passwd, whereas su asks for the target user's. This can be changed with the targetpw option in the sudoers file. Feb 23, 2021 at 23:47
  • Yes, I should've read the 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. Feb 24, 2021 at 15:42

1 Answer 1

0

I just answer now to be able to mark this as answer. (I don't like unanswered questions).

I had to read the comments of the sudoers file. There is a toggle to switch the mode, so that I can enter the root password when using sudo as normal user.

Everything is explained in the sudoers comments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .