For this exemple, our custom ssh port will be 52222.
Port 22 and change it to
Note: You can add several times the Port directive to allow several ports. This can be usefull first to not be locked out of teh server. For example:
Restart the ssh deamon:
Do not close your current ssh session and test if you can localy connect via ssh with the new port:
If it works you can
exit the test ssh connection.
Now we will need to allow this new port in the firewall.
To do so, edit
TCP="52222" (this will only allow port 52222 for ssh) or to
TCP="ssh 52222" if you want both ports.
Note: this is possible because there is
FW_CONFIGURATIONS_EXT="sshd" in your
/etc/sysconfig/SuSEfirewall2 config file. Known terms (mapping between well known ports and services, ex: ssh=22) are in
/etc/services, it's not advised to modify this file.
Now restart the firewall:
Question: Why did we tested local ssh connection before modifying the firewall rules? Because the change we made only affects external connections (i.e. from the internet) so local connection are not restricted by firewall port filtering.
Now we can safely exit the remote ssh connection.
Now to connect to the server we have to specify the ssh port:
or add a custom entry in
.ssh/config (single user) or
/etc/ssh_config (all users):
and simply connect with: