# Python SSH

**URL:** <https://forum.networklessons.com/t/python-ssh/10725>\
**Category:** Lessons Discussion\
**Created:** [April 14, 2020, 2:00pm UTC](https://forum.networklessons.com/t/python-ssh/10725 "2020-04-14T14:00:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Giovanni](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/g/7ea924/32.png) [@Giovanni](https://forum.networklessons.com/u/Giovanni)\
**Post date:** [April 28, 2020, 5:04pm UTC](https://forum.networklessons.com/t/python-ssh/10725/5 "2020-04-28T17:04:58Z")

</div>

So it doesn’t seem to work.

It works using more channels like this ..

```
import paramiko
import cmd
import time
import sys

buff = ''
resp = ''

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.99.10', username='test', password='test')
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

#run command
chan = ssh.invoke_shell()

# turn off paging
chan.send('terminal length 0\n')
time.sleep(1)
resp = chan.recv(9999) # recv(nbytes)
                            #Receive data from the channel. The return value is a string representing the data received. 
                            # The maximum amount of data to be received at once is specified by nbytes. 
                            # If a string of length zero is returned, the channel stream has closed.

output = resp.decode('ascii').split(',')

print (''.join(output))

# Display output of first command
chan.send('sh ip int br')
chan.send('\n')
time.sleep(1)
resp = chan.recv(9999)
output = resp.decode('ascii').split(',')
print (''.join(output))

# Display output of second command
chan.send('sh ver')
chan.send('\n')
time.sleep(1)
resp = chan.recv(9999)
output = resp.decode('ascii').split(',')
print (''.join(output))

#closer
ssh.close()

```

> [https://evilttl.com/wiki/Execute-MULTIPLE-commands-with-Python](https://evilttl.com/wiki/Execute-MULTIPLE-commands-with-Python)

---

_[View the full topic](https://forum.networklessons.com/t/python-ssh/10725)._
