Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example script written in python that executes remotely commands over ssh
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() )
ssh.connect('5.79.4.10', username='root', password='7raW6nS6Krttest')
stdin, stdout, stderr = ssh.exec_command('echo text on stdout stream; echo text on stderror stream 1>&2')
print("reading outputs from the remote command")
for l in stdout :
print("stdout : %s" % l.strip())
for l in stderr:
print("stderr : %s" % l.strip())
ssh.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment