2610

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

Question:

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,

<blockquote>

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

</blockquote>

This only happens SOMETIMES

Answer1:

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

Recommend

  • Python script for creating zip file in remote server
  • How to get size of remote file?
  • How does SSH Window Size affect in paramiko
  • WCF service timing out
  • ASP.NET Session ending abruptly
  • Passing inputs to program prompt in a batch file
  • Timeout a command efficiently and capture output to a variable in bash script
  • Julia: Can you set a time limit on eval
  • variable scope in AJAX calls
  • ASP.NET 2.0 Session Timeout
  • How can I get a specific line from a text file? [duplicate]
  • Query timeout expired in django-mssql when executing custom SQL directly
  • Google OAuth2 for an web application hosted behind NAT (intranet server without public IP)
  • parsing numbers from a text file
  • How to resolve docker host names (/etc/hosts) in containers
  • How to make HttpWebRequest async
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Cannot upload to OneDrive using the new SDK
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Redux Form - Not able to type anything in input
  • how to find common suffix in java by using method
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • htaccess add www if not subdomain, if subdomain remove www
  • Django rest serializer Breaks when data exists
  • Cannot resolve symbol 'MyApi'
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • TFS: Get latest causes slow project reloading
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Running a C# exe file
  • Hazelcast - OperationTimeoutException
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • File upload with ng-file-upload throwing error
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Getting error when using KSoap library to consume .NET web services
  • Authorize attributes not working in MVC 4
  • Reading document lines to the user (python)
  • How can i traverse a binary tree from right to left in java?
  • UserPrincipal.Current returns apppool on IIS