OpenSSH

2021/12/8 6:47:51

本文主要是介绍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
登出

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



这篇关于OpenSSH的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程