Python Script to SSH
<p>I am a beginner trying to do SSH writing a basic code, I have tried everything not able to debug this , My code is as follows :</p>

<pre><code>import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print ("1")
ssh.connect('196.5.5.6', username='abc', password='abc')
print ("2")
stdin, stdout, stderr = ssh.exec_command('show version')
print ("3")
output= stdout.readlines()
print ("4")
print(output)
</code></pre>

<p>Output I get is 1<br>
2<br>
3

<br>
At 4 it get's stuck somewhere , there is problem that I am not able to fetch the data , Please help anyone. Code just hangs at the output step. Everywhere the solution is totally same.</p>

<p>You should enter commands try this </p>

<pre><code>import paramiko 
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print ("1")
ssh.connect('ip', username='user', password='pass')
print ("2")
stdin, stdout, stderr = ssh.exec_command('show version')
print ("3")
stdin,stdout,stderr = ssh.exec_command("ls /")
print stdout.readlines()
</code></pre>

python shell ssh