ssh-agent命令是一种控制用来保存公钥身份验证所使用的私钥的程序。ssh-agent在X会话或登录会话之初启动,所有其他窗口或程序则以客户端程序的身份启动并加入到ssh-agent程序中,下面良许教程网为大家分享一下Linux常用命令ssh-agent命令具体使用方法。
命令格式
格式: ssh-agent [选项] [参数]
常用选项
-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:设置默认值添加到代理人的身份最大寿命
参考示例
打印本身的环境和变量
[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 ~]#
调试模式
[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 1234
把ssh-agent进程杀掉
[root@localhost ~]# ssh-agent -k SSH_AGENT_PID not set, cannot kill agent [root@localhost ~]#
生成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 ~]#
以上就是
为各位朋友分享的 相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多 等着你 !