cannot log in to the server after changing SSH port [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








3















I am using putty to connect to my Ubuntu 16.04 VPS.



I decided to change the default SSH port from 22 to 443.
I did this changing the line



Port 22


in /etc/ssh/sshd_config



to Port 443



Now when I am trying to connect to the server using port 443 I get the error saying "Server unexpectedly closed network connection"



When I try to connect to the server using port 22 I get the error saying "Network error: Connection refused"



The server is up and running I just cannot connect to it anymore, is there anyway to fix this?



EDIT: I reinstalled the VPS and reconfigured it again.
The possible issue that might have caused this could be that I used the same port to connect to my VPS using Putty and to use that same port for my proxy in squid.










share|improve this question















closed as off-topic by Jenny D, kasperd, Tommiie, Ward Mar 12 at 4:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – Jenny D, kasperd, Tommiie, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 2





    Don't bother changing the ssh port. It doesn't make you more secure, but it does give you a false sense of security. It also gives you lots of problems if you are new.

    – Michael Hampton
    Mar 10 at 13:56











  • Thank you, but I have fixed it already. My reason is to make my proxy as anonymous as possible, when port 22 is open websites can see that and that is an indication of proxy

    – shiu'sho
    Mar 10 at 15:02






  • 2





    Having port 22 open does not indicate a proxy.

    – Michael Hampton
    Mar 10 at 15:18











  • Might be, I do now know, I am just trying to set up an anonmous proxy and I am using whatleaks.com to check what I need to take care of. Does Passive OS fingerprints different than Browser Agent indicate a proxy?

    – shiu'sho
    Mar 10 at 17:08












  • You can't use the same port for two separate services. If you do want to use another port than 22, use one that's not already in use by something else.

    – Jenny D
    Mar 13 at 14:26

















3















I am using putty to connect to my Ubuntu 16.04 VPS.



I decided to change the default SSH port from 22 to 443.
I did this changing the line



Port 22


in /etc/ssh/sshd_config



to Port 443



Now when I am trying to connect to the server using port 443 I get the error saying "Server unexpectedly closed network connection"



When I try to connect to the server using port 22 I get the error saying "Network error: Connection refused"



The server is up and running I just cannot connect to it anymore, is there anyway to fix this?



EDIT: I reinstalled the VPS and reconfigured it again.
The possible issue that might have caused this could be that I used the same port to connect to my VPS using Putty and to use that same port for my proxy in squid.










share|improve this question















closed as off-topic by Jenny D, kasperd, Tommiie, Ward Mar 12 at 4:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – Jenny D, kasperd, Tommiie, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 2





    Don't bother changing the ssh port. It doesn't make you more secure, but it does give you a false sense of security. It also gives you lots of problems if you are new.

    – Michael Hampton
    Mar 10 at 13:56











  • Thank you, but I have fixed it already. My reason is to make my proxy as anonymous as possible, when port 22 is open websites can see that and that is an indication of proxy

    – shiu'sho
    Mar 10 at 15:02






  • 2





    Having port 22 open does not indicate a proxy.

    – Michael Hampton
    Mar 10 at 15:18











  • Might be, I do now know, I am just trying to set up an anonmous proxy and I am using whatleaks.com to check what I need to take care of. Does Passive OS fingerprints different than Browser Agent indicate a proxy?

    – shiu'sho
    Mar 10 at 17:08












  • You can't use the same port for two separate services. If you do want to use another port than 22, use one that's not already in use by something else.

    – Jenny D
    Mar 13 at 14:26













3












3








3








I am using putty to connect to my Ubuntu 16.04 VPS.



I decided to change the default SSH port from 22 to 443.
I did this changing the line



Port 22


in /etc/ssh/sshd_config



to Port 443



Now when I am trying to connect to the server using port 443 I get the error saying "Server unexpectedly closed network connection"



When I try to connect to the server using port 22 I get the error saying "Network error: Connection refused"



The server is up and running I just cannot connect to it anymore, is there anyway to fix this?



EDIT: I reinstalled the VPS and reconfigured it again.
The possible issue that might have caused this could be that I used the same port to connect to my VPS using Putty and to use that same port for my proxy in squid.










share|improve this question
















I am using putty to connect to my Ubuntu 16.04 VPS.



I decided to change the default SSH port from 22 to 443.
I did this changing the line



Port 22


in /etc/ssh/sshd_config



to Port 443



Now when I am trying to connect to the server using port 443 I get the error saying "Server unexpectedly closed network connection"



When I try to connect to the server using port 22 I get the error saying "Network error: Connection refused"



The server is up and running I just cannot connect to it anymore, is there anyway to fix this?



EDIT: I reinstalled the VPS and reconfigured it again.
The possible issue that might have caused this could be that I used the same port to connect to my VPS using Putty and to use that same port for my proxy in squid.







ubuntu networking ssh linux-networking port






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 10 at 13:05







shiu'sho

















asked Mar 9 at 21:51









shiu'shoshiu'sho

162




162




closed as off-topic by Jenny D, kasperd, Tommiie, Ward Mar 12 at 4:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – Jenny D, kasperd, Tommiie, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Jenny D, kasperd, Tommiie, Ward Mar 12 at 4:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – Jenny D, kasperd, Tommiie, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 2





    Don't bother changing the ssh port. It doesn't make you more secure, but it does give you a false sense of security. It also gives you lots of problems if you are new.

    – Michael Hampton
    Mar 10 at 13:56











  • Thank you, but I have fixed it already. My reason is to make my proxy as anonymous as possible, when port 22 is open websites can see that and that is an indication of proxy

    – shiu'sho
    Mar 10 at 15:02






  • 2





    Having port 22 open does not indicate a proxy.

    – Michael Hampton
    Mar 10 at 15:18











  • Might be, I do now know, I am just trying to set up an anonmous proxy and I am using whatleaks.com to check what I need to take care of. Does Passive OS fingerprints different than Browser Agent indicate a proxy?

    – shiu'sho
    Mar 10 at 17:08












  • You can't use the same port for two separate services. If you do want to use another port than 22, use one that's not already in use by something else.

    – Jenny D
    Mar 13 at 14:26












  • 2





    Don't bother changing the ssh port. It doesn't make you more secure, but it does give you a false sense of security. It also gives you lots of problems if you are new.

    – Michael Hampton
    Mar 10 at 13:56











  • Thank you, but I have fixed it already. My reason is to make my proxy as anonymous as possible, when port 22 is open websites can see that and that is an indication of proxy

    – shiu'sho
    Mar 10 at 15:02






  • 2





    Having port 22 open does not indicate a proxy.

    – Michael Hampton
    Mar 10 at 15:18











  • Might be, I do now know, I am just trying to set up an anonmous proxy and I am using whatleaks.com to check what I need to take care of. Does Passive OS fingerprints different than Browser Agent indicate a proxy?

    – shiu'sho
    Mar 10 at 17:08












  • You can't use the same port for two separate services. If you do want to use another port than 22, use one that's not already in use by something else.

    – Jenny D
    Mar 13 at 14:26







2




2





Don't bother changing the ssh port. It doesn't make you more secure, but it does give you a false sense of security. It also gives you lots of problems if you are new.

– Michael Hampton
Mar 10 at 13:56





Don't bother changing the ssh port. It doesn't make you more secure, but it does give you a false sense of security. It also gives you lots of problems if you are new.

– Michael Hampton
Mar 10 at 13:56













Thank you, but I have fixed it already. My reason is to make my proxy as anonymous as possible, when port 22 is open websites can see that and that is an indication of proxy

– shiu'sho
Mar 10 at 15:02





Thank you, but I have fixed it already. My reason is to make my proxy as anonymous as possible, when port 22 is open websites can see that and that is an indication of proxy

– shiu'sho
Mar 10 at 15:02




2




2





Having port 22 open does not indicate a proxy.

– Michael Hampton
Mar 10 at 15:18





Having port 22 open does not indicate a proxy.

– Michael Hampton
Mar 10 at 15:18













Might be, I do now know, I am just trying to set up an anonmous proxy and I am using whatleaks.com to check what I need to take care of. Does Passive OS fingerprints different than Browser Agent indicate a proxy?

– shiu'sho
Mar 10 at 17:08






Might be, I do now know, I am just trying to set up an anonmous proxy and I am using whatleaks.com to check what I need to take care of. Does Passive OS fingerprints different than Browser Agent indicate a proxy?

– shiu'sho
Mar 10 at 17:08














You can't use the same port for two separate services. If you do want to use another port than 22, use one that's not already in use by something else.

– Jenny D
Mar 13 at 14:26





You can't use the same port for two separate services. If you do want to use another port than 22, use one that's not already in use by something else.

– Jenny D
Mar 13 at 14:26










3 Answers
3






active

oldest

votes


















5















is there anyway to fix this?




  • Use the system console (out of band connection) if available.

  • Use the VPS recovery boot to mount the VPS disk and then edit the sshd_config file to reset the port to 22 from 443.

Less optimally



  • Boot a new VPS instance, configure as per the first instance using your configuration management tools and recover from backups.





share|improve this answer























  • Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

    – shiu'sho
    Mar 10 at 8:52












  • You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

    – Iain
    Mar 10 at 20:21


















0














You probably have forgotten to add port 443 to firewall (ufw). Make console connection if possible, otherwise your VPS provider can help you.






share|improve this answer























  • I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

    – shiu'sho
    Mar 10 at 8:20


















-1














  1. Verify your sshd service is running, netstat to check which port is it listening

  2. Verify your port being added to firewall

  3. Check logs from /car/log/messages to see if any messages tells you about it.

  4. While you connect, try to use -vvv option to know more info on it

  5. Try to see if ssh -p 443 root@othrhost works





share|improve this answer





























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5















    is there anyway to fix this?




    • Use the system console (out of band connection) if available.

    • Use the VPS recovery boot to mount the VPS disk and then edit the sshd_config file to reset the port to 22 from 443.

    Less optimally



    • Boot a new VPS instance, configure as per the first instance using your configuration management tools and recover from backups.





    share|improve this answer























    • Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

      – shiu'sho
      Mar 10 at 8:52












    • You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

      – Iain
      Mar 10 at 20:21















    5















    is there anyway to fix this?




    • Use the system console (out of band connection) if available.

    • Use the VPS recovery boot to mount the VPS disk and then edit the sshd_config file to reset the port to 22 from 443.

    Less optimally



    • Boot a new VPS instance, configure as per the first instance using your configuration management tools and recover from backups.





    share|improve this answer























    • Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

      – shiu'sho
      Mar 10 at 8:52












    • You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

      – Iain
      Mar 10 at 20:21













    5












    5








    5








    is there anyway to fix this?




    • Use the system console (out of band connection) if available.

    • Use the VPS recovery boot to mount the VPS disk and then edit the sshd_config file to reset the port to 22 from 443.

    Less optimally



    • Boot a new VPS instance, configure as per the first instance using your configuration management tools and recover from backups.





    share|improve this answer














    is there anyway to fix this?




    • Use the system console (out of band connection) if available.

    • Use the VPS recovery boot to mount the VPS disk and then edit the sshd_config file to reset the port to 22 from 443.

    Less optimally



    • Boot a new VPS instance, configure as per the first instance using your configuration management tools and recover from backups.






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 9 at 22:19









    IainIain

    105k14164258




    105k14164258












    • Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

      – shiu'sho
      Mar 10 at 8:52












    • You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

      – Iain
      Mar 10 at 20:21

















    • Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

      – shiu'sho
      Mar 10 at 8:52












    • You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

      – Iain
      Mar 10 at 20:21
















    Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

    – shiu'sho
    Mar 10 at 8:52






    Thank you for your reply @Iain. I rebooted my VPS in rescue mode and was able to connect to it in that mode, but when I go to /etc/ssh/sshd_config I am seeing #Port 22 and not Port 443 It means that I cannot access the original file, the one in recovery mode is somehow different

    – shiu'sho
    Mar 10 at 8:52














    You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

    – Iain
    Mar 10 at 20:21





    You will need to mount the root partition/lv/whatever into the recovery environment. Your VPS host should provide information on how to do that.

    – Iain
    Mar 10 at 20:21













    0














    You probably have forgotten to add port 443 to firewall (ufw). Make console connection if possible, otherwise your VPS provider can help you.






    share|improve this answer























    • I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

      – shiu'sho
      Mar 10 at 8:20















    0














    You probably have forgotten to add port 443 to firewall (ufw). Make console connection if possible, otherwise your VPS provider can help you.






    share|improve this answer























    • I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

      – shiu'sho
      Mar 10 at 8:20













    0












    0








    0







    You probably have forgotten to add port 443 to firewall (ufw). Make console connection if possible, otherwise your VPS provider can help you.






    share|improve this answer













    You probably have forgotten to add port 443 to firewall (ufw). Make console connection if possible, otherwise your VPS provider can help you.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 10 at 8:05









    Pratik GautamPratik Gautam

    1




    1












    • I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

      – shiu'sho
      Mar 10 at 8:20

















    • I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

      – shiu'sho
      Mar 10 at 8:20
















    I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

    – shiu'sho
    Mar 10 at 8:20





    I am reading now about UFW and it says that by default it is disabled, so I guess that is not the case, anyway, could you provide the instructions how to add the port to UFW please? If you could, please be as much clear with every step as possible since it is my day 3 in Linux. Thanks!

    – shiu'sho
    Mar 10 at 8:20











    -1














    1. Verify your sshd service is running, netstat to check which port is it listening

    2. Verify your port being added to firewall

    3. Check logs from /car/log/messages to see if any messages tells you about it.

    4. While you connect, try to use -vvv option to know more info on it

    5. Try to see if ssh -p 443 root@othrhost works





    share|improve this answer



























      -1














      1. Verify your sshd service is running, netstat to check which port is it listening

      2. Verify your port being added to firewall

      3. Check logs from /car/log/messages to see if any messages tells you about it.

      4. While you connect, try to use -vvv option to know more info on it

      5. Try to see if ssh -p 443 root@othrhost works





      share|improve this answer

























        -1












        -1








        -1







        1. Verify your sshd service is running, netstat to check which port is it listening

        2. Verify your port being added to firewall

        3. Check logs from /car/log/messages to see if any messages tells you about it.

        4. While you connect, try to use -vvv option to know more info on it

        5. Try to see if ssh -p 443 root@othrhost works





        share|improve this answer













        1. Verify your sshd service is running, netstat to check which port is it listening

        2. Verify your port being added to firewall

        3. Check logs from /car/log/messages to see if any messages tells you about it.

        4. While you connect, try to use -vvv option to know more info on it

        5. Try to see if ssh -p 443 root@othrhost works






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 10 at 14:58









        SunilSunil

        242




        242












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay