Linux-centos7 How to recover a password

Source: Internet
Author: User

1. What if I forget the root password?

Using single-user mode

First step: Restart the Linux server

Restart command: Reboot,init 6,shutdown-r now

Shutdown command: Poweroff,init 0


OK, restart the server. Then enter the login screen

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/97/9A/wKiom1kwJffi1LQWAADM5oyOg9o846.jpg-wh_500x0-wm_ 3-wmp_4-s_3034605112.jpg "title=" snap1.jpg "alt=" Wkiom1kwjffi1lqwaadm5oyog9o846.jpg-wh_50 "/>

Use the upper and lower keys, select the red arrow, press the E key, enter the Grub interface, as follows

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/97/9B/wKioL1kwJk-S0lW0AADwKTdnw54422.jpg-wh_500x0-wm_ 3-wmp_4-s_2059105402.jpg "title=" snap1.jpg "alt=" Wkiol1kwjk-s0lw0aadwktdnw54422.jpg-wh_50 "/>

Then find the red Arrow place, as follows

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/97/9A/wKiom1kwJsbiVhX6AAEQKTW795k540.jpg-wh_500x0-wm_ 3-wmp_4-s_2425024351.jpg "title=" snap2.jpg "alt=" Wkiom1kwjsbivhx6aaeqktw795k540.jpg-wh_50 "/>

Modify the contents of the RO for RW init=/sysroot/bin/sh crashkernel=auto, and then ctrl+x, enter the following interface

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/97/9A/wKiom1kwJ5_AlQw0AACu58dQnBg033.jpg-wh_500x0-wm_ 3-wmp_4-s_901066711.jpg "title=" snap3.jpg "alt=" Wkiom1kwj5_alqw0aacu58dqnbg033.jpg-wh_50 "/>

Using the command ls/sysroot/root/

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/97/9B/wKioL1kwKAmBAdCFAADDytx4lAg929.jpg-wh_500x0-wm_ 3-wmp_4-s_2955386793.jpg "title=" snap4.jpg "alt=" Wkiol1kwkambadcfaaddytx4lag929.jpg-wh_50 "/>

Discovery is the same as the content in the normal system ls/root.

Use the command:

Chroot/sysroot

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/97/9A/wKiom1kwKvfTqd1UAADFGg9SdxI036.jpg-wh_500x0-wm_ 3-wmp_4-s_3708619030.jpg "title=" snap6.jpg "alt=" Wkiom1kwkvftqd1uaadfgg9sdxi036.jpg-wh_50 "/>

This is used, and you find the same as the normal system.

Use the command passwd root to change the password, and don't forget to modify the environment variable: lang=en

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/97/9A/wKiom1kwK3fzFH7hAAD-ZkFP59U605.jpg-wh_500x0-wm_ 3-wmp_4-s_134148352.jpg "title=" snap7.jpg "alt=" Wkiom1kwk3fzfh7haad-zkfp59u605.jpg-wh_50 "/>

Finally, don't forget a key command:

Touch/.autolabel


Finally restart the server, the password reverts to the password you just modified.

This scenario must be local, if the remote way is implemented not to come







Linux-centos7 How to recover a password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.