Articles on: VPS

Can I Change The Port ssh Listens On?

Yes you can change the port that SSH listens to by editing the /etc/ssh/sshd_config file and uncommenting (Remove the # from the beginning the line) the line containing below.

#Port 22

Example of a changed SSH port

Port 55555

You then can change the number to a uncommon SSH port. Some good examples are 5555 or 33333. You will then have to open that port on in the APF configuration file located at /etc/apf/conf.apf.

You will want to add this new port number to the lines below.

Warning: Remember to place a # right in front of the word Common below

Common ingress (inbound) TCP ports


Common egress (outbound) TCP ports

After saving the conf.apf file you will need to restart both APF and sshd by issuing the command below on the command line.

/etc/init.d/apf restart && /etc/init.d/sshd restart

Updated on: 07/01/2023

Was this article helpful?

Share your feedback


Thank you!