You can’t log in as root and you think that you have lost your password?
Does your system allow direct root login? You may have the correct password, and it just may not permit root logins
- Try using the same password with su if you haven’t already.
- Or if your normal user has sudo access you can use that one. That might be the problem.
You have lost your root password – root login is allowed
- Boot with your favorite rescue-CD (e.g. Knoppix), become root
- mount the root-partition of your system read/write (let’s say to /mnt).
- Then do ‘chroot /mnt’. You will now be running your regularly installed linux.
- Do ‘passwd root’ and type in the new password.
- Press ctrl-D to leave the chroot-environment
- unmount your root-partition and reboot.
How do you do it without a rescue disk? Enter single user mode.
With GRUB: (Assuming you haven’t set a grub password):
- At the grub boot menu highlight the system you wish to boot and tap ‘e’.
- Highlight the kernel line and tap ‘e’ again to edit.
- Append the following to the kernel line which will cause it to boot to single user mode.
- Tap ‘b’ to boot. After the boot you will have the
- Type the following to remount the root partition read-write.
mount -o remount,rw /
- Type the following to change the root password.
- Enter your new password and tap ENTER. Repeat to confirm
- Type the following after setting the new password:
mount -o remount,ro /
- Use Ctrl Alt Del to reboot.
- When you see the boot: prompt, type ‘linux single’ to enter single-user mode.
- If you have used some other title than the default ‘linux’ for your system, then use that with the word ‘single’.
- At the bash# prompt type
- You’ll be asked to re-type the password for verification.
- After you’ve changed the password reboot by typing ‘shutdown -r now’.
- Then log in to root with the new password.