Fourth session of the Week (January 25)
1.13 Single-user mode
(1) Single user mode purpose: RESET login password;
(2) Enter single user mode
after the host has just turned on or restarted, press the keyboard "↑" or "↓" key, enter the system selection interface, press keyboard "↑" or "↓" key, choose CentOS Linux (3.10.0-514.e17.x86_64) 7 (Core), the installation system version is different, there are some differences; Select OK, press "E" key to enter the edit boot command;
First find "linux16" at the beginning of the line, and then find "Ro", will be replaced by the RO RW init=/sysroot/bin/sh
After the change, press "Ctrl+x" to start;
Enter the original system, command #chroot/sysroot
language is English ( if not set, display as garbled ), command #lang=en
Change Password, command #passwd root Enter new password, enter new password again
Create a. autorelabel file (and Selinu, if not created, the password does not take effect), command #touch/.autorelabel
Force restart, and then login to enter the latest password, you can complete the reset password.
1.14 Rescue Mode
(1) Rescue mode purpose: Resetting the login password or repairing the system file error;
(2) Rescue mode and single-user mode differences, rescue mode with CD-ROM, and in the case of not knowing the grub password;
(3) Enter rescue mode
First put the Linux installation CD into the CD-ROM drive, power on, press the DELETE key to enter the BIOS, set the CD Boot
Select the Boot tab and move the CD-ROM drive first,
F10 button, save and exit
after rebooting, go to the boot menu, keyboard "↑" or "↓" key Select troubleshooting, enter
Select Rescue a CentOS Linux system, enter, follow the prompts, and then enter
Enter 1, (1 means continue, 2 means read-only loading, 3 means skip shell,4 to exit), enter
Enter, English prompt command chroot/mnt/sysimage can enter the original host system
input command chroot/mnt/sysimage into the original system input
Change Password command passwd root or passwd, enter new password, confirm new password
Force restart the machine and remove the disc.
1.15 Cloning a virtual machine
menu bar, click Virtual Machine, dropdown list management, right list select clone, Next, Next, Clone method general Select Create Link clone (full clone takes up too much space, no need), next
Fill in the virtual machine name, browse the storage location, here default
Click Done, auto Generate,
To change the IP address, refer to the IP configuration to learn the note-taking method by clicking Close.
Change host name, command Hostnamectl set-hostname centos702
1.16 Linux machines log in to each other
(1) Interconnect command SSH [email protected];
ssh-p Port If port connection is specified [email protected]
Description: SSH command for the system to bring, the user name may not be entered to indicate the current user, write only IP;
(2) SSH key authentication
Generate Key command Ssh-keygen, enter, do not set a password enter, do not set the password enter,
Copy the public key and save it on the host that needs to be connected
Turn selinux off, command setenforce 0; connect ssh [email protected], no password login is successful.
Linux Learning notes the fourth session of the first week (January 25)