Connecting to amazon lightsail ubuntu server using different ssh port












1















I have changed ssh port in lightsail server in /etc/ssh/sshd_config file to 2200, I have enabled firewall to accept connections on port 2200. But when I am trying to connect through my local machine using command,



ssh -i key.pem ubuntu@13.xxx.x.109 -p 2200


It is showing me an error "ssh: connect to host 13.xxx.x.109 port 2200: Connection refused". Can you help me out why it's connection is being refused?










share|improve this question

























  • Has the key already been shared to the lightsail server, could you use it to login successfully on the default port? Also, do you need to use the absolute path to the key file?

    – Arronical
    Mar 28 '18 at 9:51











  • yeah i was able to connect to lightsail server through port 22 using private key but when I changed port settings and enabled firewall settings on lightsail server its showing me the error shown above. Currently I am using ubuntu as local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:07








  • 1





    Did you change the port that the ssh server is listening on and restart the ssh server? This is normally done in the /etc/ssh/sshd_config file on the server you're trying to ssh into.

    – Arronical
    Mar 28 '18 at 12:24








  • 1





    yes I did changed the port to 2200 and i also checked with nmap, its showing "host is up" on 2200 port of lightsail ubntu server,that means 2200 port is open on server but it's not listening on port 2200 when i am connecting through ssh using my local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:38
















1















I have changed ssh port in lightsail server in /etc/ssh/sshd_config file to 2200, I have enabled firewall to accept connections on port 2200. But when I am trying to connect through my local machine using command,



ssh -i key.pem ubuntu@13.xxx.x.109 -p 2200


It is showing me an error "ssh: connect to host 13.xxx.x.109 port 2200: Connection refused". Can you help me out why it's connection is being refused?










share|improve this question

























  • Has the key already been shared to the lightsail server, could you use it to login successfully on the default port? Also, do you need to use the absolute path to the key file?

    – Arronical
    Mar 28 '18 at 9:51











  • yeah i was able to connect to lightsail server through port 22 using private key but when I changed port settings and enabled firewall settings on lightsail server its showing me the error shown above. Currently I am using ubuntu as local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:07








  • 1





    Did you change the port that the ssh server is listening on and restart the ssh server? This is normally done in the /etc/ssh/sshd_config file on the server you're trying to ssh into.

    – Arronical
    Mar 28 '18 at 12:24








  • 1





    yes I did changed the port to 2200 and i also checked with nmap, its showing "host is up" on 2200 port of lightsail ubntu server,that means 2200 port is open on server but it's not listening on port 2200 when i am connecting through ssh using my local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:38














1












1








1


1






I have changed ssh port in lightsail server in /etc/ssh/sshd_config file to 2200, I have enabled firewall to accept connections on port 2200. But when I am trying to connect through my local machine using command,



ssh -i key.pem ubuntu@13.xxx.x.109 -p 2200


It is showing me an error "ssh: connect to host 13.xxx.x.109 port 2200: Connection refused". Can you help me out why it's connection is being refused?










share|improve this question
















I have changed ssh port in lightsail server in /etc/ssh/sshd_config file to 2200, I have enabled firewall to accept connections on port 2200. But when I am trying to connect through my local machine using command,



ssh -i key.pem ubuntu@13.xxx.x.109 -p 2200


It is showing me an error "ssh: connect to host 13.xxx.x.109 port 2200: Connection refused". Can you help me out why it's connection is being refused?







ssh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 '18 at 9:47









Arronical

13.5k84892




13.5k84892










asked Mar 28 '18 at 8:51









Bhanu SankhyanBhanu Sankhyan

61




61













  • Has the key already been shared to the lightsail server, could you use it to login successfully on the default port? Also, do you need to use the absolute path to the key file?

    – Arronical
    Mar 28 '18 at 9:51











  • yeah i was able to connect to lightsail server through port 22 using private key but when I changed port settings and enabled firewall settings on lightsail server its showing me the error shown above. Currently I am using ubuntu as local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:07








  • 1





    Did you change the port that the ssh server is listening on and restart the ssh server? This is normally done in the /etc/ssh/sshd_config file on the server you're trying to ssh into.

    – Arronical
    Mar 28 '18 at 12:24








  • 1





    yes I did changed the port to 2200 and i also checked with nmap, its showing "host is up" on 2200 port of lightsail ubntu server,that means 2200 port is open on server but it's not listening on port 2200 when i am connecting through ssh using my local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:38



















  • Has the key already been shared to the lightsail server, could you use it to login successfully on the default port? Also, do you need to use the absolute path to the key file?

    – Arronical
    Mar 28 '18 at 9:51











  • yeah i was able to connect to lightsail server through port 22 using private key but when I changed port settings and enabled firewall settings on lightsail server its showing me the error shown above. Currently I am using ubuntu as local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:07








  • 1





    Did you change the port that the ssh server is listening on and restart the ssh server? This is normally done in the /etc/ssh/sshd_config file on the server you're trying to ssh into.

    – Arronical
    Mar 28 '18 at 12:24








  • 1





    yes I did changed the port to 2200 and i also checked with nmap, its showing "host is up" on 2200 port of lightsail ubntu server,that means 2200 port is open on server but it's not listening on port 2200 when i am connecting through ssh using my local machine.

    – Bhanu Sankhyan
    Mar 28 '18 at 12:38

















Has the key already been shared to the lightsail server, could you use it to login successfully on the default port? Also, do you need to use the absolute path to the key file?

– Arronical
Mar 28 '18 at 9:51





Has the key already been shared to the lightsail server, could you use it to login successfully on the default port? Also, do you need to use the absolute path to the key file?

– Arronical
Mar 28 '18 at 9:51













yeah i was able to connect to lightsail server through port 22 using private key but when I changed port settings and enabled firewall settings on lightsail server its showing me the error shown above. Currently I am using ubuntu as local machine.

– Bhanu Sankhyan
Mar 28 '18 at 12:07







yeah i was able to connect to lightsail server through port 22 using private key but when I changed port settings and enabled firewall settings on lightsail server its showing me the error shown above. Currently I am using ubuntu as local machine.

– Bhanu Sankhyan
Mar 28 '18 at 12:07






1




1





Did you change the port that the ssh server is listening on and restart the ssh server? This is normally done in the /etc/ssh/sshd_config file on the server you're trying to ssh into.

– Arronical
Mar 28 '18 at 12:24







Did you change the port that the ssh server is listening on and restart the ssh server? This is normally done in the /etc/ssh/sshd_config file on the server you're trying to ssh into.

– Arronical
Mar 28 '18 at 12:24






1




1





yes I did changed the port to 2200 and i also checked with nmap, its showing "host is up" on 2200 port of lightsail ubntu server,that means 2200 port is open on server but it's not listening on port 2200 when i am connecting through ssh using my local machine.

– Bhanu Sankhyan
Mar 28 '18 at 12:38





yes I did changed the port to 2200 and i also checked with nmap, its showing "host is up" on 2200 port of lightsail ubntu server,that means 2200 port is open on server but it's not listening on port 2200 when i am connecting through ssh using my local machine.

– Bhanu Sankhyan
Mar 28 '18 at 12:38










2 Answers
2






active

oldest

votes


















1














You need to turn on the port of the lightsail manage console.



Use Custom not SSH
Then change the ssh port to 2200






share|improve this answer































    0














    I am using aws LightSail and I ended up doing the following:




    • add to lightsail management console:
      Application = Custom,
      Protocol = TCP,
      Port = 2200


    • edit the port in sshd_config in /etc/ssh/ folder to 2200.


    • restart sshd by sudo service restart sshd


    • add the rule to firewall sudo ufw allow 2200/tcp


    • enable the firewall sudo ufw enable



    Hope this helps!






    share|improve this answer








    New contributor




    CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1019891%2fconnecting-to-amazon-lightsail-ubuntu-server-using-different-ssh-port%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      You need to turn on the port of the lightsail manage console.



      Use Custom not SSH
      Then change the ssh port to 2200






      share|improve this answer




























        1














        You need to turn on the port of the lightsail manage console.



        Use Custom not SSH
        Then change the ssh port to 2200






        share|improve this answer


























          1












          1








          1







          You need to turn on the port of the lightsail manage console.



          Use Custom not SSH
          Then change the ssh port to 2200






          share|improve this answer













          You need to turn on the port of the lightsail manage console.



          Use Custom not SSH
          Then change the ssh port to 2200







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 20 '18 at 17:18









          Luis TorruellaLuis Torruella

          112




          112

























              0














              I am using aws LightSail and I ended up doing the following:




              • add to lightsail management console:
                Application = Custom,
                Protocol = TCP,
                Port = 2200


              • edit the port in sshd_config in /etc/ssh/ folder to 2200.


              • restart sshd by sudo service restart sshd


              • add the rule to firewall sudo ufw allow 2200/tcp


              • enable the firewall sudo ufw enable



              Hope this helps!






              share|improve this answer








              New contributor




              CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                0














                I am using aws LightSail and I ended up doing the following:




                • add to lightsail management console:
                  Application = Custom,
                  Protocol = TCP,
                  Port = 2200


                • edit the port in sshd_config in /etc/ssh/ folder to 2200.


                • restart sshd by sudo service restart sshd


                • add the rule to firewall sudo ufw allow 2200/tcp


                • enable the firewall sudo ufw enable



                Hope this helps!






                share|improve this answer








                New contributor




                CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  0












                  0








                  0







                  I am using aws LightSail and I ended up doing the following:




                  • add to lightsail management console:
                    Application = Custom,
                    Protocol = TCP,
                    Port = 2200


                  • edit the port in sshd_config in /etc/ssh/ folder to 2200.


                  • restart sshd by sudo service restart sshd


                  • add the rule to firewall sudo ufw allow 2200/tcp


                  • enable the firewall sudo ufw enable



                  Hope this helps!






                  share|improve this answer








                  New contributor




                  CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  I am using aws LightSail and I ended up doing the following:




                  • add to lightsail management console:
                    Application = Custom,
                    Protocol = TCP,
                    Port = 2200


                  • edit the port in sshd_config in /etc/ssh/ folder to 2200.


                  • restart sshd by sudo service restart sshd


                  • add the rule to firewall sudo ufw allow 2200/tcp


                  • enable the firewall sudo ufw enable



                  Hope this helps!







                  share|improve this answer








                  New contributor




                  CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 1 hour ago









                  CharIntCharInt

                  1




                  1




                  New contributor




                  CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  CharInt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1019891%2fconnecting-to-amazon-lightsail-ubuntu-server-using-different-ssh-port%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      GameSpot

                      connect to host localhost port 22: Connection refused

                      Getting a Wifi WPA2 wifi connection