主机1:
hostname server.example.com
vmset.sh 100
useradd -m timinglee
passwd timinglee
timinglee
主机2:
hostname client.example.com
vmset.sh 200
2.
[root@server200 .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:uheLti/lVNKwUJk9CFEPu1b1wWzAwGOWuPXsX/aRIWk root@server200.timinglee.org
The key's randomart image is:
+---[RSA 3072]----+
| o=+B.+o+. |
| . *+X...+. |
| ..Oo= .o |
| +oo oE . |
| So .. . o|
| o+ . oo|
| .= o . oo|
| +.+ . .|
| .o=. |
+----[SHA256]-----+
[root@server200 .ssh]# ls
id_rsa id_rsa.pub known_hosts known_hosts.old
ssh -l root 172.25.254.100 -p22
[root@server100 桌面]# vim /etc/ssh/sshd_config
[root@server home]# vim /etc/ssh/sshd_config
AllowUsers timinglee root
[root@server home]# systemctl restart sshd.service
[root@server200 .ssh] ssh-copy-id -i id_rsa.pub root@172.25.254.100
测试
[root@client .ssh]# ssh -l root 172.25.254.100
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Apr 20 17:03:54 2024 from 172.25.254.1
[root@server ~]#
[root@server ~]# exit
注销
Connection to 172.25.254.100 closed.