OpenSSH

OpenSSH

  • OpenSSH开源免费提供ssh远程安全登录的程序
  • ssh协议端口:22/tcp
  • 服务名:sshd
  • ssh提供密钥认证登录方式
#生成公私钥
[root@localhost ~]# ssh-keygen
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:Yjcq3+SAOmVQgCbRVC+6QgJp+rss5MK+anEwitmi4Xo root@localhost
The key's randomart image is:
+---[RSA 2048]----+
|.=oo.            |
|oo. ..           |
|=. .. .          |
|+o.. .           |
|=++.  o S        |
|O+.ooo + .       |
|Bo=oo o .        |
|+BEo o =         |
|O=*o  . o        |
+----[SHA256]-----+

#查看密钥文件
[root@localhost ~]# ls .ssh
id_rsa  id_rsa.pub

#将公钥拷贝至其他主机
[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.27

#其他主机查看公钥文件
[root@host-27 ~]# ls .ssh
authorized_keys

#验证是否实现密钥认证登录
[root@localhost ~]# ssh 192.168.0.27
Last login: Sat Jun  5 00:41:47 2021 from 192.168.0.1
[root@host-27 ~]# 
[root@host-27 ~]# exit
登出

------------恢复内容开始------------

#### OpenSSH
  • OpenSSH开源免费提供ssh远程安全登录的程序
  • ssh协议端口:22/tcp
  • 服务名:sshd
  • ssh提供密钥认证登录方式
#生成公私钥
[root@localhost ~]# ssh-keygen
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:Yjcq3+SAOmVQgCbRVC+6QgJp+rss5MK+anEwitmi4Xo root@localhost
The key's randomart image is:
+---[RSA 2048]----+
|.=oo.            |
|oo. ..           |
|=. .. .          |
|+o.. .           |
|=++.  o S        |
|O+.ooo + .       |
|Bo=oo o .        |
|+BEo o =         |
|O=*o  . o        |
+----[SHA256]-----+

#查看密钥文件
[root@localhost ~]# ls .ssh
id_rsa  id_rsa.pub

#将公钥拷贝至其他主机
[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.27

#其他主机查看公钥文件
[root@host-27 ~]# ls .ssh
authorized_keys

#验证是否实现密钥认证登录
[root@localhost ~]# ssh 192.168.0.27
Last login: Sat Jun  5 00:41:47 2021 from 192.168.0.1
[root@host-27 ~]# 
[root@host-27 ~]# exit
登出

------------恢复内容结束------------

posted on 2021-12-08 01:44  极客飞扬  阅读(102)  评论(0编辑  收藏  举报

导航