root@server \~# ssh-keygen -t rsa #此处为rsa密钥对
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:EtRb4lrkGMtSaa+JoG3bL2AfzUlJPbx114ZZyOmOf04 root@server
The key's randomart image is:
+---RSA 3072----+
| .= . B. |
| .* B o . B o |
| =.X B . o . |
| . . *.B . |
| o . *.*S o |
|. = o B. . . |
| o = . . E |
| . + ... |
| o. o. |
+----SHA256-----+
root@server \~# ssh-copy-id root@192.168.110.134 #复制该公钥文件到服务端的该目录下
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.110.134 (192.168.110.134)' can't be established.
ED25519 key fingerprint is SHA256:rFpTMCYeFtLw16vHvNCtD7f+AutcLz68mnrlopUfino.
This key is not known by any other names
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.110.134's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.110.134'"
and check to make sure that only the key(s) you wanted were added.
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 Oct 26 22:33:54 2023 from 192.168.110.1
root@client \~#
免密登陆成功!!!
client免密访问server
root@client \~# ssh-keygen -t rsa #此处为rsa密钥对
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:mmA+3Ih66Ue7yv1TBdvjbcsmmTKeK7U9rBEuW1NWOiU root@client
The key's randomart image is:
+---RSA 3072----+
| |
| . |
| +E o |
| . += |
| o So=o |
| =.+ +o+..o |
| .o=.=o=+ = . |
| oo.o.o+++B + |
|.o+oooo+== + |
+----SHA256-----+
root@client \~# ssh-copy-id root@192.168.110.136 #复制该公钥文件到服务端的该目录下
/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 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.110.136's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.110.136'"
and check to make sure that only the key(s) you wanted were added.
root@client \~# ssh 192.168.110.136 #使用SSH远程登录server
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 Oct 26 22:57:34 2023 from 192.168.110.134