Four, emergency mode, rescue mode, clone virtual machine, Linux machine Mutual Login

Source: Internet
Author: User
Tags safe mode

Four, emergency mode, rescue mode, clone virtual machine, Linux machine Mutual Login
First, emergency mode (CENTOS6 and previously called single-user mode)
You need to operate on a physical machine and cannot operate remotely.
If the grub password is not set.
1. Rebooting the system
Restart command: Reboot,init 6,shutdown-r now.
Shutdown: Init 0,poweroff.
On the Start screen, press the arrow key, select the first line, and press "E" to edit it.

2. Enter emergency mode
The interface that comes in is the grub interface. It finds the boot disk in the system, booting the hard drive to boot the kernel.
Move the cursor to the line at the beginning of the Linux16, press the RIGHT ARROW key to move the cursor to the back of the RO (read only), and change the RO to RW init=/sysroot/bin/bash. RW (read/write)

Press CTRL+X again, the system will enter the emergency mode.

3. Change the root password
/sysroot/the original system path.
The current environment is equivalent to a safe mode (memory operating system) and is not yet in the system.
Current environment view the files in the original system need to be preceded by a/sysroot/path.

Cat command: Used to view the contents of a file.
Three functions:
1. Display the entire file at once.
$ cat FileName
2. Create a file from the keyboard.
$ cat > FileName
Only new files can be created and existing files cannot be edited.
3. Merge several files into one file.
$cat file1 file2 > file
chroot command: Switch system.
Enter the command:

chroot/sysroot/

Then change the password and enter the command:

passwd Root

Found garbled, modify the language, enter the command:

Lang=en (modified to English)

Then enter the command passwd root to change the password, enter the password two times.
Re-enter the command:

Touch/.autorelabel

The last action is for SELinux to take effect, and if the command is not executed, the password will not take effect. It means that the password is lost and cannot be logged in. After executing the command, press Ctrl+d (exit the original system), and then enter reboot reboot to log in with the new password.

Second, rescue mode (rescue mode)
1. CD-ROM Boot
(1) Go to "Virtual machine settings" First check the optical drive is not booting. Check all two hooks.

(2) Turn off the virtual machine and enter the BIOS settings.
There are two methods of entry:
A) Right-click the virtual machine, enter the power supply, and then "enter the BIOS when it starts".
b) When VMware starts, press the F2 key.
After entering the BIOS, tune to boot, press-or + to mediate each startup object, and then tune the CD-ROM to the top, meaning that it starts first.

After setting up, press F10 to save the settings and exit.
2. Enter Rescue mode
Then enter the CD-ROM boot screen and select troubleshooting Enter.

Then select Rescue a CentOS system. Knock two times to enter.

This tells us that the initial system is below/mnt/sysimage, similar to/sysroot.
First, keep going.
Second, mount the initial system as read-only mode, which means that the disk cannot be written, the configuration file cannot be changed, and the root password cannot be changed.
Third, skip the shell directly.
The fourth item, restart.
Select the first entry, enter "1" and return to the carriage return.

Tip the initial system is mounted under/mnt/sysimage, to enter, you need to switch the system. To run the command:

Chroot/mnt/sysimage

Enter the initial system and execute the passwd command to change the root password.

Then Ctrl+d exit the original system, then shut down the BIOS settings, set the Startup key to the first boot of the hard disk. Another method, VMware settings, turns off the optical drive.
Iii. Cloning virtual machines
Close the running CentOS, enter shutdown command init 0. Right-click the virtual machine name, select Manage, and then select Clone.
Always click Next, the clone type will appear with the default value. , and then next set the virtual machine name and save path. Next, close when done. A cloned virtual machine appears.

First login to the cloned virtual machine, enter the command dhclient automatically obtain an IP, then ip addr View IP, and then set the static IP, set up to restart the network card or service.
Set host name
Enter the command:

Vi/etc/hostname

To change the contents of the file to yaowei-01, after saving, you can press Ctrl+d to exit the current terminal. Again, the command line has a change in the left prefix.
You can also enter hostname yaowei-01 directly, and then Ctrl+d.

Iv. Linux machines log in to each other
Create a new session in Xshell, you can directly copy 01 past, and then change the IP address.

are connected.
For example 01 even 02, in the 01 Terminal input command:

SSH 192.168.93.129

Then enter the password to connect.

Enter command W to view the system load,

SSH command (remote connection command)
SSH IP
Standard notation: SSH [email protected]
WHOAMI view current logged on user
Full wording: SSH [email protected]
You can also specify a port connection: ssh-p [email protected]

The key generation on Linux.
Command: Ssh-keygen
Again, save the path, then the password, and then generate

Re-copy the key to another machine's key file to go
Vi/root/.ssh/authorized_keys
You can use the following command to see if SELinux is open:

Getenforce

Enforcing for Open
Permissive to Off

Four, emergency mode, rescue mode, clone virtual machine, Linux machine Mutual Login

Related Article

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.