Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Suddenly, out of the blue, I can't login as root anymore. And, yes I have not forgotten my password, and indeed I have taken a close look at my CapsLock key.
Everything has been done right, login failed.
I can login as user and enter the su-mode, then the root-password is accepted.
My distribution is Mandrake 9.2, it runs about two weeks now.
Is there anybody else who has met this problem?
I have never had it happen without knowing how (yes, I was stupid enough to change my root password and forget what I changed to it...). But I do know how to fix it As I always say, no computer you can sit at is safe...
Boot off a linux boot cd, any boot cd will do so long as it has support in it's kernel for your file system. Hell, even most distribution isntall CD's will do if you can get to a prompt. Mount your root partition. Go into /etc/shadow (assuming you have shadow passwords) and delete the bunch of characters between the first and 2nd : for the root user (aka you have something like this root:bunchofchars:number:number::::: delete the bunch of numbers which is the MD5 hash of your password).
Now your root password is null, just hit enter when prompted and you can log in.
You should be able to edit this from the splash screen when the machine first boots....you just gotta stop the timer.
Here's some more stuff about it. http://www.rajeevnet.com/linux/grub_serial_console.html
Scroll down this page until you see "Single User Mode Login:" and this explains how to boot your system into single user mode. Usually, you can just enter a 1 or s instead of the word single. This is for a Red Hat system, but GRUB should work similiarly cross platforms.
Oh...all of this stuff will only work from a physical console.
All I am saying is many linux machines, mine including, require the root password to boot into single user mode, so Nytehawk's method won't work.
As long as you aren't stupid about it there is nothing wrong with editing /etc/shadow yourself. Don't be scared, it is just a text file.
But nytehawk is right, don't be stupid and boot onto a network with an empty root password... although if you really care about security I am sure you disabled root logins on all protocols you have open anyway like a good system admin always does.
In general it is always a good idea to get your root password set before you let anyone log in as any type of user on any protocol.
It was with great interest that I read your replies. As I said, I felt uncomfortable about messing with my root-password.
Searching a bit more around, I found the following reason for the problem:
I have Mandrake 9.2. Just before this problem emerged, I increased the securitylevel from HIGH to HIGHER.
This alone was the reason, for one cannot directly login as root if the system is set to this securitylevel.
Decreasing the security to the old level enabled the good old direct root-login again.
Nevertheless, thanks to all of you for your wellmeant advices!