2

I'm trying to create a new user with root privileges from visudo in order to log on the Ubuntu system.

When I run Ubuntu a dialog box appears with the name of a user, let's call it "Sr. X". If I click on "Sr. X" the system ask me for the password, which I don't know.
So I'm trying to add a new user with root privileges by running an Ubuntu image from a USB device. After locating the unit in which Ubuntu is installed, I mount it and type chroot to turn the path of the Ubuntu image into the root directory.

So far so good, the problem comes when I try to add a new user by modifying sudoers file using visudo.
User "Sr. X" doesn't appear - why is that? The only thing that appears is

root ALL=(ALL) ALL

Then, I add my user:

Myuser ALL=(ALL) ALL

save the changes and reboot the system. When I run Ubuntu, the same dialog box appears, only showing "Sr. X" again. I click on "login as another user", I put "myuser" into the dialog box and the system ask me for a password. What password should I write? I didn't add any password in the sudoers file. Can somebody help me with this?

0
3

visudo doesn't add users. Try useradd, adduser, or (if you know what you are doing) vipw.

However, if all you are trying to do is log in, just reset Sr. X's password as root:

# passwd userX
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.