Doublespeed Doublespeed - 1 month ago 6x
Linux Question

scp using paramiko doesnt work - ssh works fine

I have been able to use ssh and issue command in the remote server. Now I want to scp files from the remote server but that just seems like its impossible. I'm totally new to python and Paramiko. The error is permission denied in my local directory of darn windows. The files are supposed to come from the Mac. Any other really really simple example I can use to scp files from a remote Linux machine to my local Windows machine?

import paramiko

hostname = '192.xx.1.xx'
password = 'pop123'
username = "husbad2"
port = 22


t = paramiko.Transport((hostname, 22))
t.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(t)
sftp.put(mypath, remotepath)


To retrieve files from a remote host into a local directory

sftp.get(remotepath, localpath)