Paramiko is a python implementation of the sshv2 protocol.
Paramiko to execute Remote Commands:
We will use paramiko module in python to execute a command on our remote server.
Client side will be referenced as (side-a) and Server side will be referenced as (side-b)
Getting the Dependencies:
Install Paramiko via pip on side-a:
1
|
|
Using Paramiko in our Code:
Our Python Code:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Execute our Command Remotely:
Now we will attempt to establish the ssh connection from side-a, then run lsb_release -a
on our remote server, side-b:
1 2 3 4 5 6 |
|