2013-04-04 20 views
0

我想知道如何從一個遠程服務器跳到另一個使用paramiko的遠程服務器。我想從我的本地PC ssh到遠程-A然後從遠程-A到遠程-B和從遠程-B到遠程-C。Python:如何可以遠程從我的本地PC到remoteA到remoteb到遠程c使用Paramiko

import paramiko 
def connect(ip, usr, psw): 
client = paramiko.SSHClient() 
client.load_host_keys('/home/dgomez/.ssh/known_hosts') 
client.connect(ip, username=usr, password=psw) 
return client 

host1 = connect('192.168.1.2', 'username', 'password') 
# Here I'm connect to remote-A 

現在我想知道如何從Remote-A連接到Remote-B。

+0

您可能要檢查了這一點。 http://stackoverflow.com/questions/1911690/nested-ssh-session-with-paramiko – dusual 2013-04-04 18:02:45

+0

這可能是上述問題的重複。如果你必須這樣做,你也應該檢查你的架構或者你的服務器管理 – dusual 2013-04-04 18:06:43

回答

相關問題