【发布时间】:2023-11-21 07:40:01
【问题描述】:
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 .
当我对这条路径“/dfg/hgf/kjh/”执行 ls 时,我什么也得不到。
【问题讨论】:
-
在scp期间,它提示输入密码,你是如何处理的,似乎因为这个它不起作用。
-
是的,我在“cmd”变量中传递密码。像这样 cmd="pwd; scp {0} {1}".format(t,p)
-
我尝试通过 stdin.write('pwd') 传递密码,但也不起作用