1配置ntp时间服务器,确保客户端主机能和服务主机同步时间
开启两台虚拟机
关闭防火墙:systemctl stop firewalld
关闭selinux :setenfore 0
开启NTP服务:查看NTP是否启用 是否安装
[root@server ~]# systemctl restart chronyd
[root@client ~]# systemctl restart chronyd
[root@server ~]# vim /etc/chrony.conf
allow 192.168.159.128
local stratum 10
[root@server ~]# systemctl restart chronyd
[root@client ~]# vim /etc/chrony.conf
pool 192.168.159.100 iburst
[root@client ~]# systemctl restart chronyd
在客户端上身长公钥和私钥
[redhat@Client ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/redhat/.ssh/id_rsa):
Created directory '/home/redhat/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/redhat/.ssh/id_rsa.
Your public key has been saved in /home/redhat/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:YhQCHU3brDLryx7gcWngCOIkeV7wc9JjMpC8ZxcyPkM sesame@Client
The key's randomart image is:
+---[RSA 3072]----+
| .++o+o |
| .o+Eoo= |
|=.o+BoB.o |
|*=.o*X.o |
|..=o*++ S |
| . = = . |
| . o |
| o . |
| .=. |
+----[SHA256]-----+
查看是否生成成功
[sesame@client ~]$ ll /home/sesame/ .ssh/
总数量8
-rw-------. 1 sesame sesame 2602 9 月 01 14:24 id_rsa
-rw-r--r--. 1 sesame sesame 570 9 月 01 14:24 id_rsa.pub
将密钥文件发送给服务端
# ssh-copy-id -i /home/redhat/.ssh/id_rsa.pub 192.168.58.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/redhat/.ssh/id_rsa.pub"
The authenticity of host '192.168.58.129 (192.168.58.129)' can't be established.
ECDSA key fingerprint is SHA256:0QNib0jTAOsN3+4i+VIzcCH8VpYyONasl9j2VyenFe0.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.58.129's password:
登陆成功
[sesame@client ~]$ ssh root@192.168.58.129
Activate the web console with :systemctl enable --now cokpit.socket