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

How to reset Root user password from boot on centos 7

2572

To reset root password from boot on centos 7

The way to reset the root password on centos7 is totally different to Centos 6. Let me show you how to reset root password in CentOS 7.
While turning on the power button, at the grub boot menu press the “ e” key to edit the first boot entry
grub_boot
From the grub options, go to the line that starts with “ linux16”
linux_16

you have to go the end of the line and type “ rd.break” and then press ctrl+x
rd_break
Now the initrampfs prompt with a root shell will appear at this stage, the root file system is mounted in read only mode to /sysroot and it must be remounted with read/write (rw) permission, so enter “ mount &ndash o remount,rw /sysroot”
permission
once the file system is remounted , change it to chroot jail so that /sysroot is used as the root of the file system.this can be done by running “ chroot /sysroot”
chroot
From here the root password can be reset with “ passwd” command.
password
password_confirm

Now we can reboot but, as centos 7 uses SELINUX enforcing mode by default we have to fix the context of the /etc/shadow file so create “ touch /.autorelabel”
reboot
Creating this file automatically perform a relabel of all files on next boot
Type “ exit” twice and machine will reboot, once the reboot is complete the root account will set with a newly set password.
exit
Now the machine will reboot and the login screen appears ,
login
login using a root user with changed password

username
centos

with this, the method to reset root password from boot on centos 7 comes to an end.

Tags:
gabriel
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

If there is a root password set and i have forgotten it, but can boot normally and can use sudo?

A

yes, you can use sudo try this from a terminal

# sudo passwd -dl root

Q

I changed my password then changed it back again. Now I can't get back into my user admin message...could not update ICEauthority file/home/username/.how to recover this?

A

If something is wrong you can fix it with those commands, then logout and login again:

To fix the ownership: sudo chown : /home//.ICEauthority

To fix read/write permissions: sudo chmod 600 /home//.ICEauthority

Q

can't log in after password change (encrypts)? what will do, please give one solution?

A

login to terminal

$ ecryptfs-mount-private
You need to know your old password to mount.

This will unlock and mount your /home/$USER. At this point, we can access /home/$USER. So just cd back into it and run…

$ ecryptfs-rewrap-passphrase ~/.ecryptfs/wrapped-passphrase

Q

Changed password - now can't login to my account (full disk encyption + encrypted home folder)?

A

If you are logged in as another user (e.g. root), then replace the command

ecryptfs-rewrap-passphrase ~/.ecryptfs/wrapped-passphrase
by something like

ecryptfs-rewrap-passphrase /home/[the-user-you-whose-home-you-want-to-rewrap]/.ecryptfs/wrapped-passphrase
or (on a Live CD) by something like

ecryptfs-rewrap-passphrase /[wherever-you-temporarily-mounted-the-home-partition]/[the-user-you-whose-home-you-want-to-rewrap]/.ecryptfs/wrapped-passphrase

Q

What can I do about a "not configured" device?

A

If the device is not one you need, you can safely ignore the not configured warnings.
In some cases, it's just a variation of a supported device. This means it may be relatively easy for a developer to add support for the new card. Otherwise, a new driver would have to be written, which may not even be possible if the device is not fully documented.

Related Tutorials in How to reset Root user password from boot on centos 7

Related Tutorials in How to reset Root user password from boot on centos 7

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 Root user password from boot on centos 7

Related Forums in How to reset Root user password from boot on centos 7

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 Root user password from boot on centos 7

Related News in How to reset Root user password from boot on centos 7

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 Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

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.