Solved

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

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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 …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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