user6665922
user6665922

Reputation:

python connecting to ssh An existing connection was forcibly closed by the remote host

When I try connecting to my server

class ConnectToServer():

    def connect_to_vps(self):
        port = 22
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(self.IP, port=port, username="root", password="123", timeout=3)
        ssh.close()
scanner = ConnectToServer()
scanner.connect_to_ssh()

I get this error which is,

paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[WinError 10054] An existing connection was forcibly closed by the remote host

This only happens SOMETIMES

Upvotes: 0

Views: 2973

Answers (1)

Guilherme Linden
Guilherme Linden

Reputation: 94

You are closing your connection inside your function at ssh.close(), isn't it the problem?

Upvotes: 1

Related Questions