【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