00. 目录
01. 命令概述
ssh-add命令是把专用密钥添加到ssh-agent的高速缓存中。该命令位置在/usr/bin/ssh-add。
02. 命令格式
ssh-add [-cDdkLlXx] [-E fingerprint_hash] [-t life] [file ...]
ssh-add -s pkcs11
ssh-add -e pkcs11
- 1
- 2
- 3
03. 常用选项
-D:删除ssh-agent中的所有密钥
-d:从ssh-agent中的删除密钥
-e pkcs11:删除PKCS#11共享库pkcs1提供的钥匙
-s pkcs11:添加PKCS#11共享库pkcs1提供的钥匙
-L:显示ssh-agent中的公钥
-l:显示ssh-agent中的密钥
-t life:对加载的密钥设置超时时间,超时ssh-agent将自动卸载密钥
-X:对ssh-agent进行解锁
-x:对ssh-agent进行加锁
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
04. 参考示例
4.1 把专用密钥添加到ssh-agent的高速缓存中
[root@localhost ~]# ssh-add ~/.ssh/id_rsa
- 1
4.2 查看ssh-agent中的密钥
[root@localhost ~]# ssh-add -l
- 1
4.3 从ssh-agent中删除密钥
[root@localhost ~]# ssh-add -d ~/.ssh/id_rsa.pub
- 1
4.4 对ssh-agent进行加锁
[root@localhost ~]# ssh-add -x
- 1
4.5 显示ssh-agent中的公钥
[root@localhost ~]# ssh-add -L
- 1
评论记录:
回复评论: