"
Passion is energy. Feel the power that comes from focusing what excites you.
—— Oprah Winfrey
"
CentOS virtual machine has not been used for a long time, what should I do if I forget the password? How can it be reconciled to delete it and start again? If I want to install a certain command, can I just use yum install? What should I do if the remote connection server reports an error?
**Background: **The virtual machine forgets the root password and I don't know how to log in
**Environment: **CentOS, root account
operating:
Turn on the virtual machine, select the item page before entering the system, and press the e key to enter the system configuration file
Move the cursor down and find a sentence at the beginning of Linux16, which probably means the following:
Linux16 /vmlinuz-3.10.0xxxxxx.x86_64 root=UUID=xxxxxxxx ro crashkernel=auto rhgb quiet LANG=zh_CN.UTF-8
Add a space at the end of the line and enter init=/bin/sh
Next press Ctrl + x key combination to enter single user mode
After waiting for a while, you will find that you have entered the system, but the command line prefix becomes similar to the effect of
sh-4.2#
mount -o remount,rw /
passwd
root account passwordRepeat to enter a password with no less than 8 digits (the password is not displayed when you enter it, just enter it correctly and press Enter)
The word successfully appears to indicate that the modification is successful, but it needs to continue to take effect
Enter the following command:
touch /.autorelabel
exec /sbin/init
The next step is to wait for the system to restart (it may take a few minutes, you need to wait patiently, do not shut down halfway)
Installation commands, everyone will think of:
yum install xxx
But not all commands are true. Some are in a certain toolkit and need to download its basic environment. How to do it?
Just execute:
yum search xxx
Wait patiently for a few minutes until the execution is complete. Then install the last prompt module.
yum search killall
prompt:
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
base: mirrors.163.com
extras: mirrors.aliyun.com
*> updates: mirrors.aliyun.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Matched:killall-----------------------------------/
psmisc.x86_64 : Utilities for managing processes on your system
You can see that the
killallcommand is inpsmisc.x86_64
Then enter:
yum install psmisc.x86_64
**Background: **Use ssh to connect to the server for related operations and report errors
**Environment: **local MacOS, server CentOS
operating:
❱ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now(man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:ZBm9L5432tibaN5+weK4h9NJzqrc76lvxOUkVvSLGac.
Please contact your system administrator.
Add correct host key in/Users/ethanyan/.ssh/known_hosts to get rid ofthis message.
Offending ECDSA key in/Users/ethanyan/.ssh/known_hosts:6
ECDSA host key for192.168.xx.xx has changed and you have requested strict checking.
Host key verification failed.
ssh-keygen -R IP address you want to visit
ssh user@The ip address you want to visit
Recommended Posts