How to change the SSH port number on a Linux server




  • Avatar
    Cirrus Tecnologia

    When changing SSH port, shouldn't related fail2ban jail be adjusted, too?

  • Avatar
    Anton Maslov

    Hi Cirrus, yes it is also required to update fail2ban configuration. The article will be updated accordingly. 

  • Avatar
    John Bertin (Edited )

    Following this tutorial I was no longer access the server using SSH 

    After a bit of searching, I discovered that it is also necessary to add a custom rule in the Plesk firewall. Once I did this, I was able to access console on the new port. 

    PS. please update the guide to help others avoid being locked out as well. I used the following guide to solve the issue:





  • Avatar
    Ivan Postnikov (Edited )


    Yes, you are correct, the required port should be opened for connection in Plesk firewall or any alternative, which is used.

    That is why in the article we have the following note:

    "the new port must be opened in firewall."

  • Avatar

    If you use a custom SSH port, the local GIT deployment configuration should consider this port as well when providing instructions: Otherwise (i.e., right now), this renders the instructions useless since commands need to be changed manually.

  • Avatar
    Alexandr Nikolaenko

    Hello b_p,

    Thank you for bringing this to our attention. Indeed, in order to use GIT deployment over ssh the command should be modified to below ("ssh://" URL does not support relative paths):
    # git remote add origin ssh://

    I will create a request to a concerned department to add a corresponding note to the documentation.


Please sign in to leave a comment.

Have more questions? Submit a request