Answer the question
In order to leave comments, you need to log in
Why doesn't the python script for sftp file transfer work?
Task: there is win7 and linux host
The connection to the linux server is established but nothing further happens.
How can I make it take a folder and recursively copy it to a remote Linux host?
import paramiko
host = "192.168.2.1"
port = 22
transport = paramiko.Transport((host, port))
password = "Pass"
username = "root"
transport.connect(username = username, password = password)
sftp=ssh.open_sftp()
sftp = paramiko.SFTPClient.from_transport(transport)
path = '/share/MD0_DATA/MSSQL' + sys.argv[1]
localpath = sys.argv[1]
sftp.put(localpath, path)
sftp.close()
transport.close()
print ('Upload done!')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question