Linux里,shell脚本连接sftp
from subprocess import call
def main():
cmd5 = “”“sftp -oIdentityfile=…openssh targetAddress <
exit
EOT”""
call(cmd5,shell=True)
if name == ‘main’:
main()
注意:
- EOT: end of text。 EOF: end of file
- 最后的一个EOT前后不能有换行,空格,制表符
- 要用三个引号""" 否则报错SyntaxError: EOL while scanning string literal
- sftp部分命令:
ls, help, get xxxfile, put xxxfile, quit/bye/exit
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
