我正在寻找相当于python的eval $(ssh-agent),它将启动ssh代理,并在脚本完成后继续运行以运行。
我对谷歌没有发现任何有用的东西。
发布于 2017-10-20 15:39:53
我试图使用那个https://pypi.python.org/pypi/ssh-agent-setup/0.2.0,但它对我不起作用。看一下https://github.com/haarcuba/ssh-agent-setup上的代码,我发现这是很容易修复的。我做了叉子,并做了拉请求https://github.com/haarcuba/ssh-agent-setup/pull/2。
对于那些对使用ssh代理安装python模块感兴趣的人,您可以按照https://github.com/haarcuba/ssh-agent-setup#ssh-agent-setup指令进行操作。
如果你得到:
ssh_agent_setup.setup()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/ssh_agent_setup/__init__.py", line 34, in setup
_setupAgent()
File "/usr/local/lib/python3.6/site-packages/ssh_agent_setup/__init__.py", line 18, in _setupAgent
raise Exception( 'Could not parse ssh-agent output. It was: {}'.format( process.stdout ) )
Exception: Could not parse ssh-agent output. It was: setenv SSH_AUTH_SOCK /tmp/ssh-thoTQTiOTR0y/agent.47524;
setenv SSH_AGENT_PID 47797;
echo Agent pid 47797;如果有人想要实现类似的东西,那么代码很容易理解.py。
通过阅读代码,我现在了解了如何在python中启动ssh-agent。
https://stackoverflow.com/questions/46837914
复制相似问题