1. Change root user password
1. Restart the virtual machine and click E on the startup interface to enter this interface
. 2. Enter init=/bin/sh in UTF-8 (keep scrolling down) and then press CTRL+X to enter this interface.
3. Enter mount - o remount, rw /
and then enter passwd to change the root password. You need to enter the new password twice.
4. After changing the password, enter touch /.autorelabel
exec /sbin/init to restart the system
and wait quietly for a while.
2. Change ordinary user password
1.首先切换到root用户下
2.然后输入passwd 用户名
3.修改用户密码
Summarize
I have forgotten my password twice. It is recommended to use notepad to record your password.
Modify username (hostname)
sudo hostnamectl set-hostname