If we forget the root user's password in the production environment, there are two methods under Linux, the first one is single-user mode, which is similar to the security mode of Windows when the system starts.
The method is to restart Linux first, (the restart command has reboot, LINT6, Shutdown-r now.) The shutdown command has init0, Pweroff).
Edit Grub
Then go to the next step
Enter the LS command, and then locate the bin directory under Sysroot
Then switch to the original system environment, you can use the Chroot/sysroot command
Then confirm that in the original system, enter passwd root to change the password
Confirm Password and then enter Touch/.autorelabel virtual machine-power-Restart the client, after reboot can be logged in with the new password.
The second type of rescue mode
0-6 operating levels under Linux
Level 0: System shutdown status, the system default RunLevel cannot be set to 0, otherwise it will not start the Operation Level 1: Single user working status, root authority, for system maintenance, prohibit remote login;
Level 2: Multi-user status (no NFS support);
Level 3: Full multiuser State (with NFS), enter console command line mode after login;
Level 4: System not used, reserved. In some special cases you can use it to do something. For example, when the laptop battery is exhausted, you can switch to this mode to do some settings;
Level 5: After landing into the graphical GUI mode;
Level 6: The system shuts down gracefully and restarts, the default runlevel cannot be set to 6, otherwise it will not start normally.
If we use a single user to change the password, if we want to know Greb password, or grub is not encrypted, if we do not know the password, we can not use single-user mode to change the password, then we need to use rescue mode to change the password.
First we turn off the machine and then set
Then enter the BIOS settings
Then go to select rescue mode
Then press ENTER to install
Then press ENTER to get a shall
You can enter commands at the command line, which is somewhat similar to single-user mode, so/mnt/sysimage is the original system
Enter the original system Chroot/mnt/sysimage
passwd Root Change Password
Restart after change
Cloning a virtual machine
First shutdown, right-click management, cloning
Then open the virtual machine we just cloned, change the network configuration
Then we restart the network card, in the ping through the net.
Then we change the hostname
Exit view, modify success
Linux Interconnect
Enter the IP of another machine on a single machine
Enter a password for another machine
So that we can interconnect.
SSH connect to another host SSH [email protected] (default current system logon user if no user name is written)
If the terminal port is not 22 port ssh-p Specify the port [email protected] (SSH service default port 22)
1 week 4 Lesson Single user mode, rescue mode, clone virtual machine, Linux mutual login