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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 37 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
Great help, thanks
I am using Fedora 11 I don’t get the screen with the kernel version come up and I can’t push e to boot to single user mode. What now?
you’ll need a live cd for that, and the process will be more complex.
try posting a thread in linuxquestions.org
Will it work for fedora also. Anyway thanks.
Dear sir,
We are using server with linux o/s but the login and password has been misplaced so could you kindly help us geting our server started.
Your kind favour will be highly appreciated.
Thanks and kind regards.
Syed Mohammed
did you try what nixcraft suggested, and what was the result?
thanku so much
How to reset password if we forget password in linux?
Hi vivek,
Normally in solaris, to reset the password.
boot cdrom -s
mount the root disk
edit the /etc/shadow
null the value
save and sync
umount
reboot.
How to reset the root password in solaris, when the disks are under Veritas.
when it is mirrored under Veritas VM, how do I do? ( consider 2 disks c1t0d0 and c1t1d0). thanks for your time.
-Regards
Ram
Thanks for sharing the useful tips
Rgds
Vipro Computer Services
thank you very much……
can’t to reset after booting still view “give root password for maintenance or control d” do you have other solution?
now i am working with linux an i forget the linux server root password so i want solution on that so please help me about that
thanx it worked
Note that :
1. Linux is case-sensitive.
2. “single” is a keyword.
So, you actually need to add ” s” or ” single”.
(lower case, and you need a space before it)
sir,
i want to know that if i forget the password of linux. so ho could it possible to work in linux
You can likely just change root’s password using the normal way if you have sudo permissions: “sudo passwd root”. Setting root’s password initially is likely needed anyway under certain cases, such as when you need to ssh/sftp in as root during emergencies.
Thanks Its working
my linux user name & password forget password
thank you so much i managed to change the password
i have the latest natty newhal 11.01 ubuntu that just starts off no grub no loading… but i have stuck up with the root password trying to install the JRE platform…
Thank Q.
its help me a lot.
For RHEL-6 do the following in single user mode.
By default SELinux enabled in RHEL-6 and it will not allow you to change the password.
Run the below commands to change the password for root.
#setenforce 0 (check the SELinux changed to Permissive using command “getenforce”)
then go for password reset
#passwd
Thank you
HOW TO CHANGE USERNAME ????????????????????
what if my root folder in fedora is comming with red cross sign i cannot open it
i need to access our server hosted somewhere but the password is being forgotten….so how do i access the server from remotely….anyone help pls
Hi,
upon mounting the /proc mount point, i am getting error to specify the file system too. what should i enter there?