2017-08-02 12 views
0
I'm using paramiko to login in x machine then 
after logged in machine x there are file in some path like 
t="/abc/gfd/*" which 
i want to copy to some path like 
p=<username>@<machine-name/ip>:/dfg/hgf/kjh/. 

cmd="pwd; scp {0} {1}".format(t,p) 
pwd_of_machine_p="xyz" 
cmd="xyz; scp {0} {1}".format(t,p) 

then executing this cmd with paramiko obj like 
client.exec_command(cmd) 
which is not working . 

當我做ls到這個路徑「/ dfg/hgf/kjh /」我沒有在那裏得到任何東西。如何使用從第三本地計算機在python使用scp在兩個遠程服務器之間傳輸文件

+1

在SCP,它會提示輸入密碼,你是如何處理的是,似乎是因爲這個它不工作。 – SunilT

+0

是的,爲了處理這個問題,我將密碼傳遞給「cmd」變量。 (t,p) –

+0

我嘗試通過stdin.write('pwd')傳遞密碼,這也不起作用 –

回答

相關問題