D
D
DVoropaev2017-08-16 12:37:02
linux
DVoropaev, 2017-08-16 12:37:02

Why doesn't paramico list files?

import paramiko 

host = '***.***.***.***'
user = '********'
secret = '********'
port = 22

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=host, username=user, password=secret, port=port)
stdin, stdout, stderr = client.exec_command('cd /')
stdin, stdout, stderr = client.exec_command('ls')
data = stdout.read() + stderr.read()
print data
client.close()

An empty string is output. If you do it like this:
stdin, stdout, stderr = client.exec_command('ping localhost -c 3')
data = stdout.read() + stderr.read()
print data

then the result is displayed

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question