Skip to content

Instantly share code, notes, and snippets.

@ivanelson
Created June 17, 2014 02:58
Show Gist options
  • Select an option

  • Save ivanelson/08a27e9a06a7d0b3e78a to your computer and use it in GitHub Desktop.

Select an option

Save ivanelson/08a27e9a06a7d0b3e78a to your computer and use it in GitHub Desktop.
Python SSH via Paramiko
#-*- encoding: utf-8 -*-
""" test_paramiko.py - tests paramiko library on
localhost connection"""
import paramiko
paramiko.util.log_to_file('paramiko.log')
s = paramiko.SSHClient()
s.load_system_host_keys()
s.connect('localhost', 22, 'testuser', 'password')
stdin, stdout, stderr = s.exec_command('ifconfig')
print stdout.read()
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment