Ssh Socket Closed . Wanted an Interactive Ssh shell automation for Linux Box
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
##Creating Ssh Session
ssh.connect("gfr4123408", port=22, username='rstrusr',password='Password')
stdin,stdout,stderr = ssh.exec_command('symcfg -lockbox reset -ssv')
#Here it asks for password and i want to write password below
stdin.write("Password")
stdin.write('\n')
stdin.flush()
output=stdout.readlines()
print(output)
I Get the following Error
Traceback (most recent call last): File "", line 1, in stdin.write('password') File "C:\Users\venkar2\AppData\Local\Programs\Python\Python36\lib\site-packages\paramiko\file.py", line 402, in write self._write_all(data) File "C:\Users\venkar2\AppData\Local\Programs\Python\Python36\lib\site-packages\paramiko\file.py", line 519, in _write_all count = self._write(data) File "C:\Users\venkar2\AppData\Local\Programs\Python\Python36\lib\site-packages\paramiko\channel.py", line 1333, in _write self.channel.sendall(data) File "C:\Users\venkar2\AppData\Local\Programs\Python\Python36\lib\site-packages\paramiko\channel.py", line 831, in sendall sent = self.send(s) File "C:\Users\venkar2\AppData\Local\Programs\Python\Python36\lib\site-packages\paramiko\channel.py", line 785, in send return self._send(s, m) File "C:\Users\venkar2\AppData\Local\Programs\Python\Python36\lib\site-packages\paramiko\channel.py", line 1169, in _send raise socket.error('Socket is closed') OSError: Socket is closed
How can i resolve this as i have to configure for 200 + Devices ??
fabric
. – wkl