w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
paramiko.SSHException: Channel closed
import paramiko
s = paramiko.SSHClient()
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
conn = s.connect(hostIP, username ='root', password='rootpassword',
port=22)

command = 'pwd'
(stdin, stdout, stderr) = s.exec_command(command)

print stdout.read()
s.close()

This should work fine with root user on linux. If it's not, you are probably passing wrong values for hostIP (for ex: quotes in the value), username, password.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.