It been days since I have posted stuffs, I am posting a new issue which I have come across from a client’s system. He come to me saying he is unable to login to Linux machine using root account, and asked me to reset the password. I have logged into console and booted the machine in single usermode and reset the password. However, after booting in normal mode when I enter the password it logs in and disconnects immediately and prompts me to enter username and password again. Sounds fishy right ? I have spend around 2 hours figuring out what has gone wrong. I have checked pam configuration, passwd file entry and everything using cat command. I saw everything was perfect., then later I added a new user and checked and I was able to login to the new account and not any of the old accounts including root account, then I opened the /etc/passwd file using vi command, guess what I have got ? See below.
Wow, its in Windows format. Looks like my client or his IT person has downloaded and uploaded the file from windows machine. We can either manual remove the ^M entries at the end of all lines or use the below command provided you have installed dos2unix package in your system.
This will fix the issue and you will now be able to login to the machine without issues.
Thanks for viewing https://helpinlinux.com