[root@server ~]# rpm -qa | grep sshd
[root@server ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-01-18 09:33:48 CST; 22min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 4477 (sshd)
Tasks: 1 (limit: 10685)
Memory: 1.4M
CPU: 16ms
CGroup: /system.slice/sshd.service
└─4477 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
1月 18 09:33:48 server systemd[1]: Starting OpenSSH server daemon...
1月 18 09:33:48 server sshd[4477]: Server listening on 0.0.0.0 port 22.
1月 18 09:33:48 server sshd[4477]: Server listening on :: port 22.
1月 18 09:33:48 server systemd[1]: Started OpenSSH server daemon.
[root@client ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
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:988TGpTGreZnFGxwLH7DIDeYEF5jqNetZIa0T8hJWks root@client
The key's randomart image is:
+---[RSA 3072]----+
| o++o . |
| .Eo+.* o |
| O.B * @ |
| o O * B O |
| .S*.+ + o |
| .o.+ o |
| o.+ . |
| oo+ |
| oo. |
+----[SHA256]-----+
[root@client ~]# ll .ssh/
总用量 12
-rw-------. 1 root root 2590 1月 18 00:53 id_rsa
-rw-r--r--. 1 root root 565 1月 18 00:53 id_rsa.pub
[root@client ~]# ssh-copy-id 192.168.247.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out an
/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.247.128's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.247.128'"
and check to make sure that only the key(s) you wanted were added.
4.最后实现客户端免密登录.128
[root@server ~]# ssh 192.168.247.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 login: Thu Jan 18 09:01:40 2024
[root@client ~]#