Whitelist server IPs for SSH connection against ERROR – ssh: connect to host port: Connection refused

If you have multiple servers you’d probably need rsync to transfer files among servers via SSH. An error like this, however, will occur when CSF protects the servers against malicious SSH connection attempts:

ssh: connect to host example.com port 9999: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=x.x.x]

The solution is very simple. Just whitelist each server IP on the other server and vice versa:

csf -a 1.1.1.1

Wherein 1.1.1.1 is the other server. And perform the same:

csf -a 2.2.2.2

On the other server.

That’s it. Now you can freely SSH from and to the 2 servers.

1 thought on “Whitelist server IPs for SSH connection against ERROR – ssh: connect to host port: Connection refused”

Comments are closed.

Scroll to Top