首页 > 其他 > 详细

【原创】大叔经验分享(85)ssh秘钥之创建和使用

时间:2019-10-03 22:32:30      阅读:198      评论:0      收藏:0      [点我收藏+]

一 创建秘钥

1 Macbook

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key ($HOME/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in $HOME/.ssh/id_rsa.
Your public key has been saved in $HOME/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:HqDbdb3SyrM2pPj+rrZt0F34GUjVIlDpEKuTOT473KU you@HOST
The key‘s randomart image is:
+---[RSA 2048]----+
| o+.o.. |
| ..+ . .|
| . .+ + . |
| . . + .+ o |
| . S....o o |
| o +.=o.o.o |
| . .o+=.oo |
| . ==Eo |
| +*OB+ |
+----[SHA256]-----+

$ ls -l .ssh
total 24
-rw------- 1 you staff 1876 Sep 11 23:07 id_rsa
-rw-r--r-- 1 you staff 404 Sep 11 23:07 id_rsa.pub
-rw-r--r-- 1 you staff 1046 Aug 3 10:06 known_hosts

2 Windows

2.1 XShell

技术分享图片

 

 

 

技术分享图片

 

 

 

技术分享图片

 

 

 

技术分享图片

 

2.2 SecureCRT

技术分享图片

 

 

 

技术分享图片

 

 

技术分享图片

 

 

技术分享图片

 

 

 

技术分享图片

 

二 使用秘钥登录

1 Macbook

秘钥默认文件名及路径

$ vi /etc/ssh/ssh_config
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa

如果秘钥在以上路径,直接登录即可

$ ssh you@1.1.1.1

如果秘钥不在以上路径,有两种方法:

1)通过-i指定秘钥路径

$ ssh -i /path/to/id_rsa you@1.1.1.1

2)修改/etc/ssh/ssh_config

2 Windows

2.1 XShell

技术分享图片

 

2.2 SecureCRT

技术分享图片

 

【原创】大叔经验分享(85)ssh秘钥之创建和使用

原文:https://www.cnblogs.com/barneywill/p/11620944.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!