Linux Commands Question:
Download Questions PDF

Suppose I lost a root password and i need to give it, I treid to change it through single usermode even though i am not get a password, then what is the other procedure to give a root password?


Login into single user mode and try below things:
1. passswd [ Change Password for root ]
2. rm -rf /etc/nologin
3. remove any "nologin" shell for root user in /etc/passwd file
4. chage -l root then chage -E root
5. passwd -u root
6. chattr -i /etc/passwd /etc/shadow
7. chmod 600 /etc/securetty
8. vim /etc/rc.local --> then remove any line like say "
/etc/nplogin "
9. chsh root [ /bin/bash ]

Download Linux Commands Interview Questions And Answers PDF

Previous QuestionNext Question
How to know linux os is 32 bit or 64 bit?What are different command to check ram, process and hdd of linux machine?