?
Solved

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

Posted on 2011-03-18
2
Medium Priority
?
315 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 1000 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 1000 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.
Suggested Courses

649 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