Local Root Access
Description:
I’ve had a couple instances where I went to sudo su
and it would say I’m not in the sudoers.
To Resolve:
-
logout
-
login as root
-
type:
usermod -a -G wheel (username)
-
Then
exit
and log back in as your user. -
If you can’t login as root:
- Reboot. You’ll be given 5 seconds at the boot menu to select the operating system kernel to boot into.
- At the boot menu, press
e
to edit the existing kernel (Core). - In the boot grub menu select option to edit. Select Option to
edit (e)
- Go to the line of
Linux 16
and changero
withrw init=/sysroot/bin/sh
- Now press Control+x to start on single user mode.
- Now access the system with this command -
chroot /sysroot
- Reset the password -
passwd root
- Update selinux information -
touch /.autorelabel
- Exit chroot -
exit
- Reboot your system -
reboot
- Now do steps above to give another user sudo rights as it’s best practice to not use root directly for anything except for tasks like these.
Comments