Single-user mode, rescue mode, clone virtual machine, Linux machine Mutual Login

Source: Internet
Author: User

One, single user mode

1. Restart Linux
cannot be restarted remotely and requires a reboot on the virtual machine (host).


2, the following Start screen when you press the arrow keys, select the first, press the E key.

650) this.width=650; "Title=" clipboard (1). png "src=" https://s1.51cto.com/oss/201710/19/ 5b848a5e10e74c4b9ff76ea6a9fff9df.png "alt=" 5b848a5e10e74c4b9ff76ea6a9fff9df.png "/>


3. Enter this grub interface, GRUB is a startup tool. Grub is going to find the boot loader in the system.

650) this.width=650; "Title=" clipboard (3). png "src=" https://s3.51cto.com/oss/201710/19/ 79533467c027d3274898ba9bbf1c5f8b.png "alt=" 79533467c027d3274898ba9bbf1c5f8b.png "/>


4, move down the direction key, find linux16 this line, in the Ro. RO is read-only meaning, change it to RW,RW for read-write meaning. Then add a string: init=/sysroot/bin/sh
Sysroot is the original system is located in the directory, add string is to start the time to load a program can let me enter a command, so as to modify the password.

650) this.width=650; "Title=" clipboard (5). png "src=" https://s2.51cto.com/oss/201710/19/ 7b81aefebefe3acffb5cb686693c05f2.png "alt=" 7b81aefebefe3acffb5cb686693c05f2.png "/>

650) this.width=650; "title=" Clipboard.png "src=" https://s1.51cto.com/oss/201710/19/ 5cd5c2edb09a35554d92e6e653cf5a27.png "alt=" 5cd5c2edb09a35554d92e6e653cf5a27.png "/>


5. Press ctrl+x after adding, then enter below the interface

650) this.width=650; "Title=" clipboard (2). png "src=" https://s5.51cto.com/oss/201710/19/ E4878757ac7e82c691beed0a21d1f32a.png "alt=" E4878757ac7e82c691beed0a21d1f32a.png "/>


6, switch to the original system environment, in order to use the original system commands.
chroot/sysroot/#切换到原来的系统环境
This is the time to use the original system commands.
passwd Root #修改root密码
If you display small boxes and other garbled characters, first CTRL + C to cancel the above command. Then use: lang=en #修改系统语言, change the system language to English
You can then change the password as prompted.

650) this.width=650; "Title=" clipboard (4). png "src=" https://s3.51cto.com/oss/201710/19/ 787de78e15f1355830afaf9a24df6b90.png "alt=" 787de78e15f1355830afaf9a24df6b90.png "/>


7. Input command: Touch/.autorelabel. And then you can restart it.


8, finally can use the new password login system.


To enter single-user mode, grub is not encrypted or knows the grub password.
Run level
Init 0 #关机
Init 1 #单用户模式
Init 2-4 #多用户模式 (General entry is 3)
Init 5 #桌面模式
Init 6 #重启



Second, rescue mode

If you do not know the grub password, use the CD-ROM or the system USB drive to enter the installation system interface. Reboot and load the optical drive.
1. Turn off the machine first, then set the CD/DVD. (The real server is loaded into the CD or plugged into the system USB drive, reboot to enter the BIOS)

650) this.width=650; "Title=" clipboard (4). png "src=" https://s5.51cto.com/oss/201710/19/ C701ec05c0caaddb16c8841cdc9d5830.png "alt=" C701ec05c0caaddb16c8841cdc9d5830.png "/>


2. Reboot into BIOS
Virtual machine Point-to-power option Select Enter BIOS at startup (enter firmware when power is turned on).
The BIOS is entered to set the optical drive (System USB drive) as the first boot entry.


3. Enter the BIOS
After entering the BIOS, go to the boot option and look at the right side of the instructions to see the +-move option. Move the CD-ROM drive to the position of the first item.
Press F10 to save the exit

650) this.width=650; "Title=" clipboard (6). png "src=" https://s2.51cto.com/oss/201710/19/ 186ac5714d1500ebbb3a0e95ddad2587.png "alt=" 186ac5714d1500ebbb3a0e95ddad2587.png "/>


4, then enter the CD-ROM boot interface
The first is to install the operating system
The second Test drive
The third troubleshooting
Select the third item

650) this.width=650; "Title=" clipboard (1). png "src=" https://s4.51cto.com/oss/201710/19/ 67663577079ed103899e735e7cb782a9.png "alt=" 67663577079ed103899e735e7cb782a9.png "/>

Select the second item

650) this.width=650; "Title=" clipboard (2). png "src=" https://s5.51cto.com/oss/201710/19/ 4c2494f269081e1fe57efe35953b2b01.png "alt=" 4c2494f269081e1fe57efe35953b2b01.png "/>

1 continue, 2 read-only, 3shell, 4 exit
Select 1 to continue

650) this.width=650; "Title=" clipboard (3). png "src=" https://s3.51cto.com/oss/201710/19/ 823bc6f186b13fbb2ed651781aea8260.png "alt=" 823bc6f186b13fbb2ed651781aea8260.png "/>

Press ENTER to get a shell/

650) this.width=650; "title=" Clipboard.png "src=" https://s5.51cto.com/oss/201710/19/ 951a3dcf93bad2712821e57e0a9f1a13.png "alt=" 951a3dcf93bad2712821e57e0a9f1a13.png "/>

Enter the command chroot/mnt/sysimage/then you can change the root password. The optical drive (System U-disk) needs to be removed when rebooting.

650) this.width=650; "Title=" clipboard (5). png "src=" https://s5.51cto.com/oss/201710/19/ 18b3690d9273e13555eb0da227893786.png "alt=" 18b3690d9273e13555eb0da227893786.png "/>


In addition to the root password, the single-user mode and rescue mode can do other things. Assuming that you have changed a file to a system, you can enter rescue mode or single-user mode to modify the wrong file and then reboot the system.



Iii. Cloning virtual machines

The virtual machine needs to be shut down before cloning.
1. Right-click Virtual machine name, point management → clone.

650) this.width=650; "Title=" clipboard (2). png "src=" https://s1.51cto.com/oss/201710/19/ 3fd05792cc0b776fe23f9371e8272261.png "alt=" 3fd05792cc0b776fe23f9371e8272261.png "/>

Select Create Link clone

650) this.width=650; "title=" Clipboard.png "src=" https://s5.51cto.com/oss/201710/19/ 56a7b7b4145512c6a856a8f43c9b5303.png "alt=" 56a7b7b4145512c6a856a8f43c9b5303.png "/>

Enter the virtual machine name to select the path. then click Finish. The virtual machine is cloned well.

650) this.width=650; "Title=" clipboard (1). png "src=" https://s2.51cto.com/oss/201710/19/ D2fa58c79da1cccae6995c068c8ca3d3.png "alt=" D2fa58c79da1cccae6995c068c8ca3d3.png "/>

Then turn on the cloned virtual machine, and the login password is the same as the previous virtual machine. Modify its IP address. Otherwise it will conflict with the previous virtual machine IP. Also remove the UUID from the network configuration of the clone machine. Finally, restart the network service.
Hostname #查看主机名 (default is Localhost.localdomain)
Hostname set-hostname Test #将主机名修改为test
Cat/etc/hostname #主机名的配置文件

The key between the cloned hosts is also common.



Iv. Linux machines log in to each other

commands for remote linking
SSH User name @ip address
SSH [email protected]
When you do not specify a port, SSH defaults to connect to Port 22.
Suppose SSH connects to Port 220
ssh-p [email protected]

Key authentication between Linux hosts
The host to be accessed must have a public key and a private key on the host to be accessed.
Generate a key pair from the command Ssh-keygen.

650) this.width=650; "title=" Clipboard.png "src=" https://s3.51cto.com/oss/201710/19/ 1484d5feae8fe3aebc65af2cdb4b49fc.png "alt=" 1484d5feae8fe3aebc65af2cdb4b49fc.png "/>

Put the public key into the file of the host being accessed/root/.ssh/authorzied_keys

0 o'clock Turn off SELinux
Getenforce #查看selinux状态
Setenforce 0 #关闭seLinux
Enforcing to turn on Permissive for off



This article from "I do not just want to do network management" blog, please be sure to keep this source http://754599082.blog.51cto.com/11510506/1974417

Single-user mode, rescue mode, clone virtual machine, Linux machine Mutual Login

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.