Created
June 17, 2014 02:58
-
-
Save ivanelson/08a27e9a06a7d0b3e78a to your computer and use it in GitHub Desktop.
Python SSH via Paramiko
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #-*- 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