Lesson Four single user, rescue mode and Linux machine mutual login, virtual machine cloning

Source: Internet
Author: User

First, restart the command

 1、在linux系统里重启的命令有:reboot、init 6 、shutdown -r now ;关机命令:init 0 ,powweroff

second, single-user mode (reset the password after forgetting the root password.) (Prerequisite: Direct access to the host, and does not set the boot password case)

1、系统重新后,在开机启动画面选择第一行:CenOS Linux,with linux 3.10.0-123.17e.x86_64,看下面提示说明!

2, press E into the grub (find the system's Startup disk) interface, press the direction key to find the beginning of linux16 line, press the direction key backward, find or change to RW init=sysroot/bin/sh, according to the operation instructions to press ctrl+x Restart, there is a memory operation interface to run the command ; Switching system: chroot/sysroot/
Change the root password again and take an important step: Touch/.autorelabel (Be sure to create this file, or it will fall to the point where the system does not start properly). Press the restart button again. was successfully landed.

Third, rescue mode

1, operating level: 0 Shutdown mode 1 single user mode 2 multi-user mode 3 multi-user Mode 4 multi-user mode 5 graphics mode 6 Restart mode

2, enter with a CD, first shutdown, and then check whether the CD is set to: Connect at startup. There is no option to run the image.

3. Select the virtual machine on the VMware panel-power supply-Enter the BIOS when booting, change the CD first when the system starts. Go to the Start screen where we started the installation system, select the third item: Troubleshooting and then select: Rescue a Cenos system Then appear in the bottom screen for the Blue interface, select Continue Enter-Select OK to enter, and then enter! It is the mode that can enter the command!

4, we in the third line, see/mnt/sysimage directory that our system operating systems under/mnt/sysimage, with Cat/mnt/sysimage/root/.ssh/authorized_keys is real, Then use the command chroot/mnt/sysimage to switch the operating environment, the beginning of the command line becomes bath-4.2#, and then passwd root changes the root password. Restart, and then set the CD to not connect when booting. Success

Four, cloning a virtual machine, easy to do more testing!

1, first shutdown, and then find power-management-cloning. It's easy!

2. After cloning is complete, change the hostname hotnamectl set-hostname filename1 is set to a permanent hostname: hostnamectl--static set-hostname filename1; in Cenos 6 version, Just use the command: hostname filename Permanent change: vi/etc/sysconfig/network change IP Address: modified with vi/etc/sysconfig/network-scripts/ifcf-xxxxxx. Then you can start two machines at the same time!

Five, two Liunx interconnection

1, with SSH +IP address interconnection. (Full notation: SSH [email protected]),

2. Specify port: Ssh-p 22 (port)

3, Linux Mutual key authentication: Shh-keygen, enter set password, and then generate/root/.ssh/id_rsa (private key) and/root/.ssh/.id_rsa.pub (public key), cat file: Id_rsa.bup copy content, Paste it into/root/.ssh/authorized_keys and use the command Getenforce to see if SELinux is turned on. If turned on, close it with SETENFORCE0. (Permanently closed: SELinux config file is/etc/selinux/config edit it with Vim/etc/selinux/config: Change selinux=enforcing to Selinux=disabled) Then exit reconnect to enter the password that was set when the key was generated. Landing Success!

Edit Authorize_keys Save, close SELinux

Landing success

Lesson Four single user, rescue mode and Linux machine mutual login, virtual machine cloning

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.