Solved

Fedora14  - I changed the # root password by accident - poss to get it back ?

Posted on 2011-03-18
2
311 Views
Last Modified: 2012-06-27

That will learn me to keep away from the #

I was changing samba passwords CLI inthe early hours and I obviously made a blunder.

Its not a massive loss but it would be helpful to get it back.
Is it difficult / impossible?

0
Comment
Question by:fcek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
endege earned 250 total points
ID: 35165462
Boot using a so called "Live CD" Linux distribution, such as Knoppix.

After booting, go to a terminal and su to root (no password is required). After your priviledges have been escalated, issue the following commands (be sure to replace each /hda1 with your own root ('/') partition):

mount -o dev,rw /mnt/hda1
cd /mnt/hda1/etc

Open in new window


Once you are into your system /etc directory, you can use a text-editor (such as vim, nano, pico, etc.) to edit the /etc/shadow file where the password is stored. Various information about root and user accounts is kept in this plain-text file, but we are only concerned with the password portion.

For example, the /etc/shadow entry for the "root" account may look something like this:

root:$1$aB7mx0Licb$CTbs2RQrfPHkz5Vna0.fnz8H68tB.:10852:0:99999:7:::

Open in new window


Remove the hash part to look like this:

root::10852:0:99999:7:::

Open in new window


Now save the file and change back to the root directory and unmount the system root partition (don't forget to change the /hda1) as follows:

cd / 
umount /mnt/hda1

Open in new window


Now reboot the computer.

Once the computer has booted and you're at the login prompt, type "root" and when asked for the password just press ENTER (entering no password).

That's it!
0
 
LVL 3

Assisted Solution

by:Alberto Cortes
Alberto Cortes earned 250 total points
ID: 35166773
Solution:

If you are already login as root, just change the password back to previous one or create new one by doing:
passwd root
In case you already logout. You will need to wait until a proper time to reboot/reset. Do this from console:
1. reboot/reset
2. select the line you want to use to boot
3. type "e", this will open new screen.
4. select line that begins with "kernel", type "e" again, this will open the line to edit
5. add one space and "1" (without parenthesis, of course!). Press enter, and "b"
This will bring OS in single user mode. From here you can change password.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question