IT & IoT Security | Cloud | It's all about the life itself

Nothing in life is as important as you think it is, while you are thinking about it.

CentOS 7.2 reset root account password

Hello all,

Although not being a daily operation, you might need to reset the password of root account on some occasions. Here are the steps:

Restart the operating system and press e when prompted.

Move cursor to linux16 line and remove rhgb and quite , add rd.break enforcing=0  as shown below.

Proceed with pressing Ctrl+x in order to access the initramfs(initial RAM file system) that gets loaded into memory during the startup process. Rest of the process is so straight forward. Perform the commands those are written below.

mount -o remount,rw /sysroot
chroot /sysroot
passwd (type the_password_you_want_set twice after hitting “enter” )
exit
mount -o remount,ro /sysroot
exit

When you reach out to login screen, login through root by the typing new password and run the followings.
restorecon /etc/shadow
setenforce 1

Mission accomplished successfully 🙂 If you take some “hands-on” certification exams, you probably are not given the “root” account password and you are entailed to reset it. Keep those steps in your mind just in case.

Wish you the best.

Leave comment

Your email address will not be published. Required fields are marked with *.