System administrations

In this tutorial we will discuss about some more critical root login related issue. There are several issue those can stop root form login. We will cover all possible issue those can stop root from login in exam.

Step 1 Try to change root password

If you are lucky one then simply changing root password will complete the task. To change password

  • Boot system in single mode
  • run passwd commands
  • change password
  • reboot system

If problem still exist then go on Step 2

Step2 Check root account for expire

Examiner can deliver you a root account which is expired. For testing purpose you can also expire it. First login from root and set root account to expire

chage

Now reboot the system. Once system get restarted root will not be able to login. When root will try to login after giving username and password it get an error message ( too fast that you hardly be able to read it ) and it will put you back on login screen. To resolve this issue boot system in single mode. If you don't know how to boot system in single mode then read our previous article in which we recovered root password from single mode.

Now boot system in single mode and check whether root account is expired or not

chage
if you see date in account expire line mean root password is expired

set it to never expire from chage commands and verify that root account is set to never expire

chage

Now reboot the system and login from root If problem still exist then go on Step 3

Step3 change in /etc/shadow

shadow file contain information about all password store in Linux. Default root password should look like this

entry in shadow

Check this file also from single mode

vi shadow

If you see any ! sign in front the root line as shown in image below then remove ! sign Be very careful while making change in this file never remove any character from last of the line or from middle of the line.

editing in shadow
save this file with wq! and check password file

Now open /etc/passwd file

vi password

Entry of root account should be look like this

entry of root account

If you see nologin word in the end of line then remove it

passwd

There should be no ! sign in front of the line if any present remove ! sign form the beginning of line.

etc passwd