当前位置:网站首页>SSH配置密钥登录时需要注意私钥是否设置了密码(passphrase)
SSH配置密钥登录时需要注意私钥是否设置了密码(passphrase)
2022-06-11 01:00:00 【喜欢踢足球的老罗】

如题
最近需要配置SSH于登录后台服务器查日志,然后使用的是SSH的密钥登录方式,因为密钥对(公钥与私钥)是在服务器后台管理系统生成的,而且是前一段时间申请下来的,自己忘记了密钥申请的有填写过私钥的passphrase,然后使用的时候以为是没有私钥,所以配置不对导致各种登录不上,浪费了不少时间
网上有些文章提到SSH登录,有些标题写着是《SSH公钥登录》,这会导致大家的误解或影响记忆SSH密钥登录实际的流程
密钥登录简单说是我们生成一个密钥对(公钥与私钥),接着我们把公钥放到目标服务器上,然后用密钥去登录目标服务器。
私钥的密码(passphrase)是我们在生成密钥对的时候有机会去设置,这个设置是可选项来着。一般基于安全考虑最好是设置吧
当给私钥设置了密码会,然后用该私钥ssh到目标服务器时,终端会提示你输入私钥的密码。如果不想每次都输入私钥的密码,最简单是不用设置密码。但设置了密码又不想每次输入密码怎么办呢?
这就需要请 ssh-agent出马了(PS: ssh-agen还有强大的私钥转发功能,多用于跳板器的登录,具体可以看我下面分享的文章)
# 开启agent
eval `ssh-agent`
# 把私钥加到缓存,add进去的时候会提供输入私钥的密码
ssh-add 你的私钥文件
# 可以用 -l 参数来查看,当时加了那些私钥,确认上一定add的私钥是否
ssh-add -l
通过如上操作后,我们在当前SHELL使用ssh密钥登录就可以不用每次都输入私钥密码了
SSH登录方式
- 帐号与密码登录
- 密钥登录
- 证书登录
参考文章
边栏推荐
- ME11/ME12采购信息记录及条件记录创建及更新BAPI:ME_INFORECORD_MAINTAIN_MULTI
- [leetcode] path sum II (first glimpse recursion + backtracking)
- Linux Installation MySQL database details
- Win11触摸键盘主题如何更换?Win11更换触摸键盘主题的方法
- 视频压缩数据集TVD
- Introduction and practice of QT tcp/udp network protocol (I) TCP communication
- 【Qt】error: QApplication: No such file or directory 解决方案
- 1个月不到暴增900万播放量,B站3个流量增长密码!
- [leetcode] ordered linked list transformation binary search tree
- [Haas hands on] creative case of new video program launch we started the first phase together E01: Internet of things engineers started the remote control manipulator with you
猜你喜欢

2021-02-27image processing of MATLAB

20N10-ASEMI中小功率MOS管20N10

Complete tutorial on obtaining voltage from QGC ground station (APM voltage cannot be obtained from QGC)

视频压缩数据集TVD

ASEMI场效应管12N65参数,12N65规格书,12N65特征

【音乐】基于matlab演奏《过火》【含Matlab源码 1875期】

Union find

AI fanaticism | come to this conference and work together on the new tools of AI!

Task02: linked list
![[music] playing city of the sky based on MATLAB [including Matlab source code 1874]](/img/cf/63b04080867e93ab2e00e2e21b37df.jpg)
[music] playing city of the sky based on MATLAB [including Matlab source code 1874]
随机推荐
【音乐】基于matlab演奏《青花瓷》【含Matlab源码 1873期】
Record the actual record of my question brushing
【图像处理】基于matlab GUI多功能图像处理系统【含Matlab源码 1876期】
ACM教程 - 堆排序
---Arrange numbers---
[penetration test tool bee] how to install and use the XSS penetration test tool bee?
[leetcode] LRU cache
基于Gin、Gorm实现的在线练习系统之项目梳理
Jump without refresh - detailed explanation of pushstate and replacestate methods in history
[matlab] basic operation of MATLAB image processing
flutter 状态管理
[music] playing city of the sky based on MATLAB [including Matlab source code 1874]
记录一下我的刷题实录
Coordinates of the capital of each province in China
逻辑漏洞 / 业务漏洞
2021-2-26 compilation of programming language knowledge points
QT database learning notes (II) QT operation SQLite database
[leetcode] balanced binary tree
Virtual joystick of QT quick QML instance
QT database learning notes (I) basic concepts of database