commit | author | age | ||
e1b97d | 1 | #!/usr/bin/python3 |
SP | 2 | import paramiko |
3 | ||
4 | ssh = paramiko.SSHClient() | |
5 | #ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts"))) | |
6 | ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
7 | ssh.connect('hostname', username='', password='',port=22,timeout=5) | |
8 | stdin, stdout, stderr = ssh.exec_command('df -h') | |
9 | x=stdout.readlines() | |
10 | sftp = ssh.open_sftp() | |
11 | #sftp.put(localpath, remotepath) | |
12 | sftp.close() | |
13 | ssh.close() | |
14 | print (x) |