一、
主机1:
[root@server100 ~]# hostnamectl
Static hostname: server.example.com
[root@server100 ~]# useradd timinglee
[root@server100 ~]# passwd timinglee
主机2:
[root@server200 ~]# hostnamectl
Static hostname: client.example.com
二、
[root@server200 ~]# ssh-keygen -f /root/.ssh/id_rsa -P ""
[root@server200 .ssh]# cat id_rsa.pub
DOK30= root@client.example.com
[root@server200 .ssh]# ssh-copy-id -i id_rsa.pub root@172.25.254.100
[root@server100 .ssh]# cat authorized_keys
DOK30= root@client.example.com
[root@server100 ~]# vim /etc/ssh/sshd_config
PermitRootLogin yes
AllowUsers timinglee
[root@server100 ~]# systemctl restart sshd
测试:
[root@server200 .ssh]# ssh -l root 172.25.254.100
Activate the web console with: systemctl enable --now cockpit.socket
[root@server200 ~]# ssh -l timinglee 172.25.254.100
Last login: Fri Apr 19 22:46:37 2024 from 172.25.254.200
[timinglee@server ~]$