CentOS 8 (2)

RHEL/CENTOS 7/8 crack root password

Implementation steps

When the system starts, press any key to pause the startup

Press e to enter edit mode

Move the cursor to the line starting with linux and add the kernel parameter rd.break

Press ctrl-x to start into rescue mode

Press e to enter edit mode

Move the cursor to the line starting with linux, add the kernel parameter rd.break, press ctrl-x to start and enter the rescue mode

Reset root password

mount –o remount,rw  /sysroot 
chroot /sysroot 
passwd root
# If SELinux is enabled,Only need to perform the following operations,If it does not start,No need to execute
touch /.autorelabel
exit 
reboot

After the system restarts, enter the modified password

CentOS 8 ssh password-free login

Implementation steps

  1. Generate keys locally
  2. Add the generated public key to the server
  3. Configure server-side ssh to allow login with key

Local end: 192.168.99.222

Server side: 192.168.99.233

Generate secret key locally

ssh-keygen -t rsa

View the secret key file locally

[ root@zabbix-centos8 ~]# cd .ssh/[root@zabbix-centos8 .ssh]# ls -al
total 8
drwx------2 root root   38 Jun  103:26.
dr-xr-x---.3 root root  185 Jun  103:26..-rw-------1 root root 2602 Jun  103:26 id_rsa
- rw-r--r--1 root root  573 Jun  103:26 id_rsa.pub

Server-side directory permissions

The .ssh/ folder in the user root directory, modify the folder permissions to 700 (if there is no .ssh directory, you need to create it manually)

mkdir .ssh
chmod 700.ssh

Local synchronization public key

method one

The ssh-copy-id command can copy the public key of the local host to the authorized_keys file of the remote host, and the ssh-copy-id command will also give the user home directory (home) and ~/.ssh, and ~/ of the remote host. ssh/authorized_keys set appropriate permissions.

grammar

ssh-copy-id [-i [identity_file]][user@]machine

Options

[ root@zabbix-centos8 ~]#ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

** Method Two**

Add the data in the local id_rsa.pub to the server side.ssh/authorized_keys

[ root@zabbix-centos8 ~]#cat ~/.ssh/id_rsa.pub | ssh [email protected] 22'cat >> .ssh/authorized_keys'

View authorized_keys file

[ root@kafka-node2 .ssh]# ls -altotal 8drwx------.2 root root  48 May 3119:35.dr-xr-x---.3 root root 163 May 3119:39..-rw-r--r--1 root root 573 May 3119:35 authorized_keys-rw-r--r--.1 root root 188 Apr 1910:52 known_hosts

ssh allows login with key by default

Edit ssh configuration file

vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

Restart service

systemctl restart sshd

Local login test

Mount the local iso image

Mount the image to the file directory

mkdir /mnt/cdrom
 mount  -o loop /dev/sr0  /mnt/cdrom/

Edit repo file

vi /etc/yum.repos.d/CentOS-Media.repo
[ InstallMedia]
name=CentOS Linux 8
baseurl=file:///mnt/cdrom/BaseOS
gpgcheck=0
enabled=1[AppStream]
name=AppStream
baseurl=file:///mnt/cdrom/AppStream
enabled=1
gpgcheck=0

List RPM packages

dnf list 
dnf list |grep nginx

Recommended Posts

CentOS 8 (2)
CentOS 8 (1)
centos7 python3.7+vi
CentOS + Python3.6+
CentOS + Jenkins
1.5 Install Centos7
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos 7.5 python3.6
Centos5 installation guide
Centos6 install Python2.7.13
Centos7.6 deploy django+nginx+uwsgi
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7.0 network configuration
CentOS7 install GlusterFS
CentOS 7.0 network configuration
CentOS7 upgrade python3
CentOS 8 officially released
CentOS 7 deploy OpenLDAP+FreeRadius
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Python - centos6 installation
Centos7 install Python2.7
CentOS6.5 network settings
Centos 7.6 install seleniu
CentOS 8 officially released
CentOS7 basic configuration
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
centos system management
CentOS install mysql
CentOS7 build jenkins
Docker installation (CentOS7 installation)
Centos6.5 openssh upgrade
Centos build lnmp
Centos7 build python3.8.5+scrapy+gerapy
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS mirror types
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
CentOS 6/7 update curl
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3