LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-19-2015, 12:24 PM   #1
KelleyConfig
LQ Newbie
 
Registered: Jul 2015
Posts: 13

Rep: Reputation: Disabled
Newbie lost his password


Lost my password and lost my way. I’m in the process of learning Centos7 and had to move to another project for the last month. Returned to my computer and realized I didn’t write down my password anywhere. Oops.

So I went on line and found this solution:

1 - At the boot menu, press e to edit the existing kernel

2 - Next, scroll down to the list until you see the line underlined below ( ro ) . What we need to do is change that ro to rw and start into a bash shell. It should look like this rw init=/sysroot/bin/sh.

//So far so good. I’m now in the shell. However the next instruction is to type “chroot /sysroot” at the prompt. The prompt in the instruction, however, is :/# and my prompt is dracut:/#

//When I type chroot /sysroot at my prompt (dracut:/#), I get “failed to run command ‘/bin/sh’: No such file or directory.

//After this, the instructions are to create a new password via:

3 - Finally, run the commands below to change the root password - passwd root

4 - You’ll be prompted to create and confirm a new password. After creating the password, run the commands below to update SELinux parameters - touch /.autorelabel

Can’t seem to get past step 2.

Any help or guidance much appreciated
 
Old 08-19-2015, 01:03 PM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Umm...

What happens if you type:
Code:
chroot /sysroot /bin/bash
Instead of only:
Code:
chroot /sysroot
Best regards,
HMW
 
Old 08-19-2015, 01:43 PM   #3
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
...on second thought. The guide you followed seems to have some crucial steps missing.
Such as:
Code:
# mount –o remount,rw /sysroot
See this link instead (Procedure 24.2. Resetting the Root Password Using rd.break):
https://access.redhat.com/documentat...Using_rd.break

And here's another guide (with pictures!):
http://linoxide.com/linux-how-to/res...rhel-centos-7/

Last edited by HMW; 08-19-2015 at 01:46 PM.
 
Old 08-19-2015, 01:49 PM   #4
KelleyConfig
LQ Newbie
 
Registered: Jul 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thanks HMW. You're probably right, however I opted to just do a fresh install. Now I think l'll tattoo the password to my forehead.

Best,
Kelley
 
Old 08-19-2015, 01:49 PM   #5
wagscat123
Member
 
Registered: Jan 2009
Location: Maryland-Pennsylvania border, USA
Distribution: openSUSE 15.2/15.3, Tumbleweed, Kubuntu 18.04/21.04, macOS 10.15, antiX 19, and Linux Mint 19.3
Posts: 860
Blog Entries: 45

Rep: Reputation: 120Reputation: 120
The way I've usually gotten around that is to enter "init = /bin/bash" as a kernel boot option (in GRUB 2, select CentOS 7, press "e", and add it to the line that says "linux" or "linux16"). At the resulting bash shell, you can use passwd to reset the root password, then do an ugly reboot since systemd wasn't loaded. If you're using an older system, you may have to hook up a PS/2 keyboard for this to work.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux 2.6.15.1 The password lost , RESET PASSWORD ANDYCHAN Linux - General 2 08-18-2012 08:05 AM
I have lost my password. can you help me to recover my password in ubuntu croosnaya Linux - Newbie 4 04-17-2012 06:52 PM
[SOLVED] WD Elite - Lost Password - How -To Remove the lost password? fixcom1 Linux - General 3 03-06-2011 05:23 PM
newbie lost... kinda like paradise lost but less demon kharnevil Programming 2 04-16-2008 06:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration