1

Consider a single user(with a root user) where the user doesn't know the password of the root user which disables him from using su root and who was in sudoers file but he himself removed him from the sudoers group with the commandsudo adduser foo sudo. Now, How does the user foo will access root privileges?

0

1 Answer 1

2

Sounds like you've locked yourself out of sudo privileges. You are going to need to boot to Grub recovery mode and access root shell.

  1. Go to Grub menu by pressing shift key upon startup.

  2. Select Ubuntu recovery mode and then root shell prompt

  3. Type in:

    mount -o rw,remount /
    

    and in the next line

    usermod -aG sudo username
    

    where username is your username.

  4. Exit and restart.

  5. Check the /etc/group file. Your username should now be in the sudo group.

As long as your user is in the sudo group, Sudoers file may be modified to give privileges to access root with sudo su command, providing that you know user's password.

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