I’m trying to config scheduled backup under Virtualmin running Centos 7 and CSF.
The other server is almost identical running virtualmin 6.3.
Unfortunately, I get the error Failed to connect to SSH server : ssh: connect to host xxxx port xxx: Connection refused lost connection.
How can I trace to the source of the problem?
Thanks
Hmm, you may want to verify that the port being used above is where SSH is listening. One way to determine the port SSH is listening on is with this command:
To add on to andreycheks response, the port should also be listed and can be changed in /etc/ssh/sshd_config. Restart the SSH server afterwards if you change it. Or you could poke around in webmin under servers -> SSH server and see if you spot anything obvious.
Hi again,
Port 1395 is in /etc/ssh/sshd_config.
Result of netstat -anlp | grep sshd| grep LISTEN:
tcp 0 0 0.0.0.0:1395 0.0.0.0:* LISTEN 905/sshd
tcp6 0 0 :::1395 :::* LISTEN 905/sshd
and the connecting server’s ip address has been added to /etc/csf/csf.allow and etc/csf/csf.ignore
I can normally login using putty!
PS. SSH connection works after disabling CSF on the source VPS. It means the connecting machine is blocking the connection!!!
Any suggestion please?
Well, I’m unfortunately not too familiar with configuring CSF, but it sounds like the key is to either ensure that particular port is open in the firewall, or, that there’s some sort of issue with the whitelisting of your server’s IP.
The CSF logs on the remote server may have some additional details.
Your non standard SSH port will need to be added to the’ IPV4 out’ on the connecting machine and added to the ‘IPV4 in and out’ on the receiving machine. Normally CSF detects the SSH port and does this upon install. You must have changed the ssh port after installing csf?
CSF blocks all in and out traffic on the main and the remote. So not only do you have to open up the remote to allow connections from the main, but you have to open the main to connect out on what ever port your using.
For example, if main server is on ssh port 22(probably open by default) but your trying to connect to a remote server running on ssh port 1394. You have to open 1394 OUT on the main and 1394 in and out on the remote.
That was exactly the case. Allowing the IP address only did not work.
CSF has a Temporarily Allow/Deny feature where you can specify the IP address plus the port for a specific period of time. I set this on the client side and now the back is working fine.
The csf -g command helped me see the issue (for further references)