1

I updated a CentOS 7.3 based server to 7.4 today. After that my defined users were no longer able to sudo. Because something had messed up the root account months before I decided to reset the root password by using these steps:

  • boot to grub, press e
  • searched for the linux line and change ro to rw init=/sysroot/bin/bash
  • pressed Ctrl+X to continue boot
  • ran chroot /sysroot
  • changed the password using passwd

After another reboot to boot regularly I still can't use the root account and I even get Access denied (using ssh) or Login incorrect when using the physical console.

Any ideas ? I am basically locked out of that server

  • I assume you can't check auth log either for more specific error message. You probably need to use the same init=/bin/bash method as before to get more information (and fix the issue). – sebasth Sep 18 '17 at 14:02
3

When you ran the passwd command, it edited the /etc/shadow file to update the password while selinux wasn't running so it messed up your selinux permissions. To fix this use the same process and instead of passwd run touch /.autorelabel, then reboot. Beware that your first boot can potentially consume a lot of time, depending on amount of files and speed of drives.

This will relabel the entire filesystem to use the default selinux contexts. You could also use restorecon instead.

  • I am now at least able to do what I was able to do before: log in as a regular user. I still can't do sudo or login as the root user, but this has to be due to a different reason. – Marged Sep 19 '17 at 7:08

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.