我使用的命令来 ssh 到 Windows 服务器,我试图使用 set 命令。
set ASPERA_SCP_PASS=myPassword
ascp /directory/Test4.mov myAccount@10.1.1.1:/TEST
这里是我的 python 命令:
shell = spur.SshShell(hostname=10.0.0.1, username=Wusername, password=Wpassword, missing_host_key=spur.ssh.MissingHostKey.accept)
result = shell.run(["set", "ASPERA_SCP_PASS=myPassword])
result = shell.run(["ascp.exe", "/directory/Test4.mov", "myAccount@10.1.1.1:/TEST"])
当运行上面我通过 ssh 成功连接,但我得到这个错误的set
命令:
spur.results.RunProcessError: return code: 127
output: b''
stderr output: b'sh: line 0: exec: set: not found\n'
我发现这个工作正常:
environment = {}
environment["ASPERA_SCP_PASS"] = "password"
shell = spur.SshShell(hostname="10.1.1.1", username="username", password="passowrd", missing_host_key=spur.ssh.MissingHostKey.accept)
result = shell.run(["ascp.exe", directory, "Ausername@10.0.0.1:/"], stdout=sys.stdout, update_env=environment)
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(69条)