Q:

Is it possible to run a shell command onto a different device?

Is it possible to run a shell command onto a different device? For example, I am writing a program in python on my computer. I want this program to call a shell command on a pi that is connected to the computer. I have the IP address of the pi, but I'm not sure if it is possible or not to do this. Does anyone know?

A:

import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, port, username=username, password=password)

stdin, stdout, stderr = client.exec_command('ls -l')
print stdout.read()

