且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用python paramiko进行SSH密钥转发

更新时间:2023-12-05 13:34:16

您可以使用

You can enable SSH agent forwarding for a session in paramiko using AgentRequestHandler. To do this, call paramiko.agent.AgentRequestHandler(s) with the session s. For example:

client = paramiko.client.SSHClient()
client.connect(host, port, username)
s = client.get_transport().open_session()
paramiko.agent.AgentRequestHandler(s)

有关更多详细信息和代码,请参见这篇文章.

See this post for more details and code.