1

I have a CentOS 7 image on my local machine that I want to allow login as root. This is going to be a system dedicated for testing.

I initially tried using rescue mode and added kernel param "systemd.unit=emergency.target" but it says root login is locked.

So I start /bin/bash instead. I see root in /etc/shadow is locked using "!!". So I run passwd root and assign it a password. However, I am still unable to login as root. It keeps telling me password incorrect (I'm sure password is correct). Is there somewhere else I overlooked?

I am logging in via console, not using SSH.

1

1 Answer 1

4

Most likely you modified the filesystem in an emergency shell or from a rescue disk. Your SELinux labels are probably wrong for /etc/shadow. Easiest fix is to touch /.autorelabel and reboot normally. It will relabel the filesystem and reboot.

1
  • Just want to thank both you and @berndbausch for pointing me to the right direction, I have no idea autorelabel is a thing. Commented Jul 27, 2021 at 18:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.