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?
Asked
Active
Viewed 1,445 times
1
Yeshwanth
- 11
1 Answers
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.
Go to Grub menu by pressing
shiftkey upon startup.Select
Ubuntu recovery modeand thenroot shell promptType in:
mount -o rw,remount /and in the next line
usermod -aG sudo usernamewhere username is your username.
Exit and restart.
Check the
/etc/groupfile. Your username should now be in thesudogroup.
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.
Tim
- 33,500
user633551
- 474