Last night, when I was wondering about on the Internet, I found that some people are really confused about forgetting Linux password. So I decide to write this article "what can I do if I forgot my Linux password". I hope this can be helpful for these people.
P.S.: Forgot password in Windows 10/8.1/8/7/XP/Vista, Windows Password Recovery Tool can help reset the password efficiently.
The main part referring to reset Linux password when the Linux password was forgotten will be divided into two aspects:
World's 1st Windows Password Recovery Software to Reset Windows Administrator & User Password.
Free Download Free Download1. What is Linux Operating System?
As many people are not very familiar with Linux Operating System, here I'd like to introduce Linux Operating System at first.
Linux Operating System (Linux OS), is an open operating system. It is a freely cross-platform operating based on Unix and can be installed on PCs, laptops, networks, mobile and tablet devices, servers etc.
2. What to Do When Linux Forgot Password?
As Linux Operating System consists of two kinds of password: user password and root password, here I will show you what you can do if forgot Linux password from two different parts. Read on, please.
Part 1. Lost Root Password in Linux
If you forgot root password in Linux by accident, you can follow the guide below to retrieve the password. The process can be finished only with 2 steps. But the 1st step needs to change on the basis of the distro of Linux.
Premise: make sure you are offline, which can protect your PC from potential Internet-borne attack while you are repairing the password.
Step 1. This step varies from distro to distro.
- Red Hat and Mandrake: start with install CD #1 and boot with it. As the screen appears, press F2 and type "rescue" (type "linux rescue" for Red Hat) to boot your computer into shell/rescue mode. Then select "mount the existing partitions" and go to the console prompt. (Mandrake users please boot into "failsafe" from the Lilo menu instead)
- SuSE: boot into first install CD and press F1 when the first screen appears, then choose "Rescue System" from the menu and type "root" at the prompt.
- Other Distros: boot into your first install CD and type "linux single" to boot into single user mode (for Knoppix type "Knoppix single").
Step 2. After finishing the Step 1, type "# cd /etc" at the prompt
And follow steps below to change "passwd" and "shadow" two files.
- For passwd file, just type "# vi passwd" and then press I key, which will place the Vi editor in Insert mode. The 1st line of passwd file will probably look like"root:x:0:0:root:/root:/bin/bash", now you need to delete "x" and make the line look like "root::0:0:root:/root:/bin/bash", press the "Esc" key and type "ZZ" to save the file.
- For shadow file, type "# vi shadow" and press I key to get the Vi editor into Insert mode. Then change the 1st line of the shadow file to "root::::". And then press "Esc" key and type "ZZ" to save the file.
Step 3. Now you can reboot your computer and log in as a normal user, open a console and type "$ su # passwd". Then set the new root password and log out as root.
Part 2. Forgot User Password in Linux
Premise: you know your root password. (If you can't remember your root password, go back to Part 1 to recover it.)
Following are detailed steps that you can take when forgot Linux user password.
- Step 1. Log into your computer as root.
- Step 2. Open a terminal or console and type the three lines below:
# passwd Username (here don't type the pound symbol)
New password
New password again
- Step 3. Log out as root and then you can log into your computer as user with the new password.
Now, all steps to reset password for Linux when you forgot Linux password have been displayed here. It may be a little complicated. But read carefully and follow the step-by-step guide, you can finish the retrieving process.
World's 1st Windows Password Recovery Software to Reset Windows Administrator & User Password.
Free Download Free Download