Most of the guides on how to change default ssh port in freepbx lacks enough information to complete the process. So we composed all steps into this one page. Changing SSH port is highly recommended on a freepbx which is open to the internet. Hackers all over the world are constantly trying their best to get into pbx using open ssh port. Having said that , lets jump into the steps

how to change ssh port freepbx,
change ssh default port freepbx

1. Login to console as root user

Login to CLI console as root user by ssh or any other console option if available. For example, The cloud service provider VULTR has the websonsole available which is a secure and easy way to access the CLI console.

2. Edit the SSHD Config file

Use any of editor to edit the sshd config file located on the directory /etc/ssh/. Here we used nano editor using the below command

nano /etc/ssh/sshd_config

Once you are on the editor,

a) scroll down and uncomment the line Port 22 by removing the # infront.
b) change port 22 to custom port. For example to port 2022

To Save, On NANO editor,

Press Control + X to exit
Enter Y on prompt and Press Enter
Press Enter again without changing file name.

3. Restart the SSH Service

SSH service will be listening to the default port 22 until we restart the SSH service after making the above change. Below goes the command for ssh service restart. Note that, if you are connected to the console via SSH , your session will be disconnected by restarting ssh service. You will have to connect back using the port updated in the config file above.

service sshd restart

4. Confirm the ssh port change

Those who are using the console by means other than SSH can use the below command to confirm the port change is in effect. Remember to finish the service restart before checking or else you should see the default port in action

systemctl status sshd.service

End note: Open the port in firewall

Most of the cloud services has got a network firewall to secure from cyber attacks. To get access to ssh using the new custom port , make sure that this particular port is open in the firewall. Or else you will get a connection error which is expected. Check with your cloud service provider on how to open custom ports .

Its time for your thaughts. It will help us greatly improve in our coming articles. Did this article on how to change ssh password in freepbx help you in anyway ? If you would like to improve the information or add any missing element, please feel free to write your suggestions.

Now its your turn ! Let us know what is in your mind