Single-user mode, rescue mode, clone virtual machine, Linux machine login to each other

Source: Internet
Author: User

Single-user mode

When we forget our server's password we can go into single-user mode on our server

Modify our Password: The premise is that we have to operate the physical machine of the host, remote login is not possible!!

The single-user mode enters grub only if we don't have the password set in grub, otherwise using single-user mode will not work

Forgot grub Password Enter optical drive rescue mode


Step (Single user mode): Restart Linux (under VMware we right-click Virtual machine)--"power--" Restart the client--"Select the first item that appears on the screen---" press the E key as prompted (enter into Grub mode, Grub is found on the system boot disk)--"press the DOWN ARROW key to move the cursor to the linux16 and then the back arrow key to the RO to modify

What to modify:

RO: Read-only RW: Read/write

Init=/sysroot/bin/sh directory where the original system resides

After modification, press the reminder at the same time: Ctrl+x into Safe mode

Command: Chroot/sysroot

lang=en

passwd Root

Touch/.autorelabel

Finally restart the client



Second, rescue mode

Forgot grub Password Enter optical drive rescue mode


Step: First step Off (init 0)

--"Edit the settings of our virtual machines

Select Power-"/enter firmware when power is on (to load the optical drive at startup)

The arrow key left and right to select boot, the purpose is that we put CD-ROM drive in the first item (using "-" number)

Then press F10 to exit.


After automatic restart, select the third carriage return and enter the

Select Rescue a CentOS system carriage return

--》

The chroot/mnt/sysimage here are the same as the chroot/sysroot/above, and they are all orders to get into our original system.

P

Finally, change the boot CD-ROM under BIOS before restarting

or direct: Click on the small drive in the lower right corner of VMware to connect the CD-ROM drive and cancel the connection at startup


Restarting the client can



Cloning a virtual machine

Step: Right-click on the virtual machine------"next to create a linked clone continue to the next step to completion


After completing the login

Modify IP (because the cloned virtual machine IP is the same, the use will be problematic)

Vi/ect/sysconfig/network-scripts/ifcfg-ens33

Restart the network service when you are finished editing:

Systemctl Restart Network.service

To ping again, whether or not to pass



Set host name: Easy to distinguish

Hostnamectl Set-hostname Cansheng2



You can then use Pttuy and Xshell to connect the


Linux machines log in to each other

A (cansheng2) connection B (cansheng1)


command: SSH [email protected] (here root can be omitted, is the default system currently logged on users)

Format: SSH [email protected] IP (Linux under connect command)

Ssh-p Port [email protected] IP



You can also log in with a key

Command:

Ssh-keygen

Here the generated file path can be specified, password can also be set (I do not fill in the default)


Copy the A (cansheng2) public key to the/root/.ssh/authorized_keys of B

(a machine to log in B, you want to copy the public key from the A machine to the B machine configuration file)


Connect again is the key pair connection (, here I do not set the password so login does not require a password)

Single-user mode, rescue mode, clone virtual machine, Linux machine login to each other

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.