paramiko

オンラインドキュメント

https://pypi.org/project/paramiko/

http://docs.paramiko.org/en/stable/

インストール

pip install paramiko
1

使い方

以下の内容で paramiko_sample.py を作成する。

import paramiko
 
with paramiko.SSHClient() as client :
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(hostname="192.168.10.10", port=22, username="user1", password="????????")
    stdin, stdout, stderr = client.exec_command("uname -a")
 
    for x in stdout :
        print(x)
1
2
3
4
5
6
7
8
9

コマンドプロンプトで python paramiko_sample.py を実行する。