Q. I forgot my root password, how can I get into my system?
A. You can reset forgotten root password under Linux by booting system into single user mode or emergency mode (also known as rescue mode).
My boot loader is GRUB (see LILO boot loader below)
)Following is the procedure to reset root password if you are using GRUB as a boot loader:
- Select the kernel
- Press the e key to edit the entry
- Select second line (the line starting with the word kernel)
- Press the e key to edit kernel entry so that you can append single user mode
- Append the letter S (or word Single) to the end of the (kernel) line
- Press ENTER key
- Now press the b key to boot the Linux kernel into single user mode
- At prompt type passwd command to reset password:
You need to mount at least / and other partitions:
# mount -t proc proc /proc
# mount -o remount,rw /
Change the root password, enter:
# passwd
Finally reboot system:
# sync
# reboot
My boot loader is LILO
At LILO boot loader type linux single and press [ENTER] key:
Boot: linux single
When you get the # prompt you will need to type passwd root to reset password:
# passwd
Reboot system:
# sync
# reboot
See also:
- Howto: Recovering grub boot loader password
- Recovering deleted /etc/shadow password file
- 10 boot time parameters you should know about the Linux kernel
- Debian Linux - Grub Boot into single user mode
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 9-19-07

{ 9 comments… read them below or add one }
thanks for useful trick because many time it happens that you forget password
i want password releated information
how to reset root password
thxu very much for help
Very helpful indeed. Manage to reset now.
It’s useful not only to change pass, but also to change permissions, edit configs, etc.
what is the “sync” required for ? btw, I don’t think we have to do mounting if instead of S we append 1 to the end of kernel line… 1 is INIT single user mode.
sync is used to synchronize Disk with OS buffers, e.t. to write any dirty buffers to the disk.
How can i change the root password of another computer from this computer on network