Cannot connect using SSH

Hi guys,

Until now, I was able to connect to my box using SSH on the standard port 22. For security reasons I decided to move to it to the different port 123456. On my LAN, when I tested the connection I was able to connect to the box using the newly specified port in sshd_config. But this morning when I tried to connect remotely, I did get the following error:
Code:
ssh: connect to host 82.31.xx.xxx port 12345: Connection refused

I looked at every setting on the router and the port forwarding is all set OK, and I even turned off the firewall but without success.

Could someone suggest what else I could try?

Fred
 
I might have sorted it. I didn't make any change to my PF firewall.

pf.conf:
Code:
sshd_port = "22"
pass in on $ext_if proto tcp to ($ext_if) port { $sshd_port } keep state

I will not be able to check this point until tonight so any other suggestion is very welcome :)
 
Just to rule out the obvious it might be useful to check the output of the sockstat command. That can help you to determine if sshd is actually listening to the port you expected it to.
 
I ran the sockstat command and I could see that sshd is listening to my port. I updated the port number in my pf.conf but I still cannot access it from outside the LAN. Inside the LAN it's all good.

Has anyone any more suggestions?
 
Hi @kisscool-fr,

My router forwards port 19135 (my SSH port) to the IP address of the server. Have I set too high a range?

Fred
 
Last edited by a moderator:
No, the port number seems ok.

Have you tried to listen on your local interface on the SSH server with tcpdump and try to connect from outside? It should tell you if your router is doing the job or not.
 
No I haven't but I will. I'm back on port 22 for now. I'll keep you posted.

Thank you all.
 
Back
Top