SSH port setup

tarta

Verified User
Joined
Jan 31, 2018
Messages
27
hi,
where do I find the settings for ssh?
within /etc/ssh/ssh_config port is set to 22 whereas in reality it's custom value 332
where can I change it?
thanks
 

Richard G

Verified User
Joined
Jul 6, 2008
Messages
4,218
Location
Maastricht
I don't understand your question.
You already found your solution. In /etc/ssh/sshd_config it's set to port 22. If you want it to be 332, then change 22 to 332. However often ports below 1024 are reserved so it might be wiser to set a custom value higher then 1024.
Don't forget to restart the SSH service after changing the config.

If you meant that SSH is set to port 22 in sshd_config but you can reach it via port 332, then I would check your firewall because that is not normal. In that case something is rerouting port 332 to 22.
 

tarta

Verified User
Joined
Jan 31, 2018
Messages
27
Hi Richard,

I might not have expressed myself clearly.

I got a server where SSH connection is on 33xx port and it's working fine (SSH-key based, port 33xx).
I wanted to change the port to 22 but /etc/ssh/sshd_config the only Port entry I see is:

# Port 22

With this - I wonder in what other file/place the SSH settings are?

Regards,
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,854
Location
GMT +7.00
Hello,

First check what port ssh is on:

Code:
netstat -ntpl | grep ssh
then check iptables as Richard has suggested:

Code:
iptables-save | grep 332
change 332 to match your actual port to which you connect.

I guess you connect to your server's IP over SSH, if the IPs is different, then there might be a proxy/forwarder in a middle.
 
Top