Python: пример работы с paramiko
This commit is contained in:
15
code/Python/paramiko/ssh.py
Normal file
15
code/Python/paramiko/ssh.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
from paramiko.client import SSHClient
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
client = SSHClient()
|
||||||
|
client.load_system_host_keys()
|
||||||
|
client.connect(hostname='92.63.105.65', username='alex', key_filename='/home/user/.ssh/kvm5')
|
||||||
|
stdin, stdout, stderr = client.exec_command('ls -l')
|
||||||
|
print('stdin', dir(stdin))
|
||||||
|
|
||||||
|
print('stdout', stdout.read().decode('utf-8'))
|
||||||
|
|
||||||
|
print('stderr', dir(stderr))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Reference in New Issue
Block a user