Solved

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

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

910 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

23 Experts available now in Live!

Get 1:1 Help Now