服务器root用户:
[root@localhost ~]# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.146.128 netmask 255.255.255.0 broadcast 192.168.146.255
inet6 fe80::20c:29ff:fe2c:de8 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:2c:0d:e8 txqueuelen 1000 (Ethernet)
RX packets 309 bytes 30419 (29.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 247 bytes 24604 (24.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 17 bytes 2039 (1.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 17 bytes 2039 (1.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
客户端:
创密钥:
[redhat@localhost root]$ ssh-keygen
密钥:
[redhat@localhost root]$ ll /home/redhat/.ssh
总用量 8
-rw-------. 1 redhat redhat 2622 3月 14 20:55 id_rsa
-rw-r--r--. 1 redhat redhat 582 3月 14 20:55 id_rsa.pub
传密钥给服务器root用户:
[redhat@localhost root]$ ssh-copy-id root@192.168.146.128
远程连接服务器root用户:
[redhat@localhost root]$ ssh 'root@192.168.130.128'
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 failed login: Tue Mar 14 20:59:14 CST 2023 from 192.168.130.129 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Tue Mar 14 20:51:16 2023 from 192.168.146.1
[root@localhost ~]#