FTP over SSL (explicit encryption)

David Isaac aisaac0 at verizon.net
Fri Aug 12 12:22:10 EDT 2005


"Alan Isaac" <aisaac0 at verizon.net> wrote in message
news:CMTKe.6597$0d.5053 at trnddc03...
> http://www.lag.net/paramiko/
> However it requires the PyCrypto module.
> http://www.amk.ca/python/code/crypto
>
> Can you briefly outline how to use this as a client
> to upload and down files from a server using SFTP?


OK, the mechanics are pretty easy.

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(20)
sock.connect((hostname, port))
my_t = paramiko.Transport(sock)
my_t.connect(hostkey=None ,username=username, password=password, pkey=None)
my_chan = my_t.open_session()
my_chan.get_pty()
my_chan.invoke_shell()
my_sftp = paramiko.SFTP.from_transport(my_t)

Now my_sftp is a paramiko sftp_client.
See paramiko's sftp_client.py to see what it can do.

Alan Isaac





More information about the Python-list mailing list