Skip to content

Instantly share code, notes, and snippets.

@kurozumi

kurozumi/scp.py

Last active Jul 5, 2016
Embed
What would you like to do?
【Python】SCPで外部サーバーのファイルをローカルにコピーする方法
from paramiko import SSHClient,AutoAddPolicy
from scp import SCPClient
HOST = "203.0.113.0"
PORT = "22"
USER = "username"
PSWD = "password"
ssh = SSHClient()
ssh.set_missing_host_key_policy(AutoAddPolicy())
ssh.connect(HOST, port=PORT, username=USER, password=PSWD)
scp = SCPClient(ssh.get_transport())
scp.get("/home/User/file.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.