Local Root Access

less than 1 minute read

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:

  1. logout

  2. login as root

  3. type: usermod -a -G wheel (username)

  4. Then exit and log back in as your user.

If you can’t login as root:

  1. Reboot. You’ll be given 5 seconds at the boot menu to select the operating system kernel to boot into.

  2. At the boot menu, press e to edit the existing kernel (Core).

  3. In the boot grub menu select option to edit. Select Option to edit (e)

  4. Go to the line of Linux 16 and change ro with rw init=/sysroot/bin/sh

  5. Now press Control+x to start on single user mode.

  6. Now access the system with this command - chroot /sysroot

  7. Reset the password - passwd root

  8. Update selinux information - touch /.autorelabel

  9. Exit chroot - exit

  10. Reboot your system - reboot

  11. 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.