Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import paramiko
- hostname = '192.168.1.1'
- port = 22
- username = 'foo'
- password = 'xxxYYYxxx'
- if __name__ == "__main__":
- #paramiko.util.log_to_file('paramiko.log')
- s = paramiko.SSHClient()
- #s.load_system_host_keys()
- s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # use this
- s.connect(hostname, port, username, password)
- stdin, stdout, stderr = s.exec_command('pwd')
- print stdout.read()
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement