How to change the SSH port number on a Linux server

Follow

Comments

6 comments

  • 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: https://support.plesk.com/hc/en-us/articles/115001078014-How-to-manage-firewall-rules-on-a-Plesk-for-Linux-server

     

     

     

     

  • Avatar
    Ivan Postnikov (Edited )

    @John,

    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
    b_p

    If you use a custom SSH port, the local GIT deployment configuration should consider this port as well when providing instructions: https://docs.plesk.com/en-US/onyx/administrator-guide/website-management/git-support/using-a-local-repository.75825/. 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://user@example.com:22:/var/www/vhosts/example.com/git/test.git

    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