Paramiko Python SSH library provides a convenient
that allows easy transfer of files over SSH.
A distinction from the command line utility
is that “put"ing a file must include the full destination path including filename, to avoid
This Paramiko example shows copying a file from local computer to remote computer over SSH in Python.
from paramiko import SSHClient source = "foo.txt" dest = "~/Documents/foo.txt" with SSHClient() as ssh: ssh.load_system_host_keys() ssh.connect("server.invalid") with ssh.open_sftp() as sftp: sftp.put(source, dest)