00. 目录
01. 命令概述
ssh-agent命令是一种控制用来保存公钥身份验证所使用的私钥的程序。ssh-agent在X会话或登录会话之初启动,所有其他窗口或程序则以客户端程序的身份启动并加入到ssh-agent程序中。通过使用环境变量,可定位代理并在登录到其他使用ssh机器上时使用代理自动进行身份验证。
其实ssh-agent就是一个密钥管理器,运行ssh-agent以后,使用ssh-add将私钥交给ssh-agent保管,其他程序需要身份验证的时候可以将验证申请交给ssh-agent来完成整个认证过程。
02. 命令格式
格式: ssh-agent [选项] [参数]
- 1
03. 常用选项
-a bind_address:bind the agent to the UNIX-domain socket bind_address
-c:生成C-shell风格的命令输出
-d:调试模式
-k:把ssh-agent进程杀掉
-s:生成Bourne shell 风格的命令输出
-t life:设置默认值添加到代理人的身份最大寿命
- 1
- 2
- 3
- 4
- 5
- 6
04. 参考示例
4.1 打印本身的环境和变量
[root@localhost ~]# ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-mEzZAcgaaUTc/agent.79715; export SSH_AUTH_SOCK;
SSH_AGENT_PID=79716; export SSH_AGENT_PID;
echo Agent pid 79716;
[root@localhost ~]#
- 1
- 2
- 3
- 4
- 5
- 6
4.2 调试模式
[root@localhost ~]# ssh-agent -d
SSH_AUTH_SOCK=/tmp/ssh-msMhqUI6VBdK/agent.79750; export SSH_AUTH_SOCK;
echo Agent pid 79750;
debug2: fd 3 setting O_NONBLOCK
- 1
- 2
- 3
- 4
4.3 把ssh-agent进程杀掉
[root@localhost ~]# ssh-agent -k
SSH_AGENT_PID not set, cannot kill agent
[root@localhost ~]#
- 1
- 2
- 3
4.4 生成C-shell风格的命令输出
[root@localhost ~]# ssh-agent -c
setenv SSH_AUTH_SOCK /tmp/ssh-oNG3p6IS07db/agent.79817;
setenv SSH_AGENT_PID 79818;
echo Agent pid 79818;
[root@localhost ~]#
- 1
- 2
- 3
- 4
- 5
评论记录:
回复评论: