• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Reset/Recover Forgotten Root User Account Password

1068

To Reset/Recover Forgotten Root User Account Password in RHEL/CentOS 7

Resetting/Recovering Forgotten Root User Account Password in RHEL/CentOS 7 is explained in this article. There are various ways to reset root password and we are going to follow “ Booting into single user mode” type to reset the password.

To try login using with Login Credentials

First let us try to login as root in the CentOS 7 server. If you have forgot your password then try logging in with the user credentials. Now we have logged in using the user1. It is not possible to change the password of the root from the user login.

login


To reset the password

Now boot into single user mode and reboot the Server, as soon as you see the below screen and then Press ' e' from keyboard.

boot_screen

After hitting ' e' from keyboard, you will get the display as shown below. 4

Search for the text rhgb quiet and replace it with init=/bin/bash

edit_console

After editing press ' ctrl+x' and it will start booting with specified parameter. Now a bash prompt appears.

booting

To change the root password

You should have read-write permission on root partition to change the root password.

bash-4.2# mount -o remount,rw /

Change the root password by typing the passwd command. Relabel SELinux context. If we skip relabeling the whole SELinux context we would be able to login using password.

bash-4.2# passwd root
[Enter New Password]
[Re-enter New Password]

bash-4.2# touch /.autorelabel
Reboot and login again to root account.

bash-4.2# exec /sbin/init

login

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to reset forgotten root password without booting?

A

Not possible, you have boot into single user mode to set forgotten root password.

Q

Will this password reset also corrupt my data? Using Centos 6.4 distro?

A

No, your data won’t be corrupted or lost.

Q

how can i see the other username and password after root pass change?

A

follow the link, In /etc/password and /etc/shadow file.

Q

What if I don’t know the username?

A

cat /etc/passwd

Sample output:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin

you can only list the usernames with command:

awk -F':' '{ print $1}' /etc/passwd

Sample output:

root
daemon
bin
sys

Q

How to reset/recover the ROOT password in openSUSE?

A

1. Boot the system and select the normal boot menu from the list. Once selected, in the “Boot Options” box type

“init=/bin/bash” if you are using GRUB Boot loader

“linux init=/bin/bash” if you are using LILO Boot Loader

Related Tutorials in How to Reset/Recover Forgotten Root User Account Password

Related Tutorials in How to Reset/Recover Forgotten Root User Account Password

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Reset/Recover Forgotten Root User Account Password

Related Forums in How to Reset/Recover Forgotten Root User Account Password

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018

Related News in How to Reset/Recover Forgotten Root User Account Password

Related News in How to Reset/Recover Forgotten Root User Account Password

Nearly 20% of the 1000 Most Popular Docker Containers Have No Root Password
Nearly 20% of the 1000 Most Popular Docker Containers Have No Root Password
May 24, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.