0

Is it possible to reset the password of CentOS 7?

Asked 4 years ago (Apr 19, 2021) in the field of Operating Systems by Harta2020

Hi, I am a beginner at Linux. Could you please guide me on how can I reset my CentOS 7 password?


Answers


0
Answered 4 years ago (Apr 20, 2021) by Eldernode Staff

Connect to the appropriate server console. Reset the server and press the e button on the first line at the time of initial boot (GRUB) before automatic boot.

In the next step, go to the line that starts with the phrase Linux16 and find ro and change it to rw init=/sysroot/bin/sh. Then press the Ctrl and x buttons on the keyboard at the same time. (Ctrl + x)

If you have done the previous steps correctly, you will be logged in without being asked for a password. Now run the following command:

chroot /sysroot

To change the password, run the passwd root command, type the new password, and press Enter. Type the new password again and press Enter to apply.

After performing the above step, run the following command to update the SELinux parameters:

touch /.autorelabel

Finally, enter the following command to exit and then restart the system to apply the changes:

exit
reboot

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day