I'm new to Paramiko. I am attempting to create a simple script that allows anyone to use their Linux credentials to run the command. I decided to test with a simple ls
command but I am receiving errors.
import paramiko
username = *<USERNAME>*
hostname = *<HOSTNAME>*
port = 22
trans = paramiko.Transport((hostname,port))
trans.connect(username=username, password=password)
channel = trans.open_channel("session")
print(channel.send_ready())
print(channel.get_transport())
stdin,stdout,stderr = channel.exec_command("ls -lah")
trans.close()
I am receiving the following error:
TypeError Traceback (most recent call last)
<ipython-input-28-ce837beea6fe> in <module>()
6 trans.connect(username=username, password=password)
7 channel = trans.open_channel("session")
----> 8 stdin,stdout,stderr = channel.exec_command("ls -lah")
TypeError: 'NoneType' object is not iterable
Any Ideas as to what I might be doing incorrectly?