Connection closed by remote host in Putty with hosting provider says that the problem is not on their side
I use my smartphone as my "router", with dynamic IP addresses, for nearly 3 years and never had any problem SSHing into various shared hosting environments with Putty.
I host my website on a CentOS based shared server environment by Namecheap (Stellar business plan); I have joined there with that plan a few months ago; I normally SSH into that shared hosting environment with an all default Putty 0.70 and the SSH connection is being done with a keyphrased private key and public key.
In the last few days I have started to experience sudden disconnections from Namecheap's shared server environment with Putty, with the error:
Connection closed by remote host
This problem would normally occur less than five mintues after the SSH connection to that environment:
- I can experience a disconnection while typing commands
- It doesn't matter if commands have been executed or not
- Changing keepalive value from 0 to 1 didn't help
- A similar problem happens with MobaXterm
Contacting Namecheap's support
I have tried to contact the customer support of Namecheap and they say that they have tried to SSH into my account from their computer and didn't encounter any problem.
They suggested to reboot the router (my smartphone) and to try again; I did so by principle but it didn't solve the problem.
Namecheap's staff also asked me to execute various
tracert NAMECHEAP_IP commands from CMD spanning hundreds of lines (hence I avoid pasting it here) and after reviewing all the output they said:
The issue seems to be caused by a dynamic IP address. It causes a logout very soon after logging in via SSH.
The dynamic IP can be provided by your current ISP (or it can be a feature of the VPN connection if you use any).
The possible solutions are:
- Contacting your ISP for providing a static IP address or a dynamic IP address, but within the same /24 subnet only.
- Configuring a VPN service with a static IP (or within /24 subnet as well).
I have no desire to use a static IP, nor do I want to use a VPN.
How would you suggest to cope with that problem?
In that particular case I can bypass the problem by using GUI tools but I still ask this by principle.
I think that the problem is now solved.
Namecheap's support staff reported:
Our technical department has found that the SSH access was not enabled properly for your hosting account:
the cPanel username was not added correctly in whitelist here: /etc/csf/csf.pignore.nc .
As a result, our firewall noticed that some processes kept being open and closed the connection. The cPanel username is added now.
To me that makes sense because indeed the problem started after changing a Cpanel username.