Last active
July 5, 2016 14:09
-
-
Save kurozumi/dfcec3fa6a97959d8d2a to your computer and use it in GitHub Desktop.
【Python】SCPで外部サーバーのファイルをローカルにコピーする方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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