Solved

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

Posted on 2011-03-18
2
305 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now