SSH port setup

tarta

Verified User
Joined
Jan 31, 2018
Messages
81
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
 
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.
 
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,
 
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.
 
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
Code:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak`date +%F`
Code:
sudo chmod a-w /etc/ssh/sshd_config.bak
Code:
cd /etc/
Code:
vi /etc/ssh/sshd_config
(Open port on CSF Firewall)
Code:
sudo service sshd restart
Cheers.
 
Back
Top