How do I set up my SSH keys so I can copy files from my local PC to a remote shared server?












1














I want to start using SSH instead of FTP, but I am clueless when it comes to SSH keys.



I'd like to use a Gulp command to transfer my files (as I do now with FTP). I've found a good amount of NPM packages that do this. However, none explain how to actually set up SSH keys on my remote shared (LAMP) server and on my local machine (MacOS).



Would anyone know how to set this up? All the tutorials I've found deal with setting up the node.js package, not the SSH keys themselves.



Update with additional information




  • The server is Linux. It is a cheap shared LAMP stack server running CPanel

  • I am able to only access the server via CPanel and FileZilla FTP (but not SFTP)

  • The output of running ssh -i ~/.ssh/id_rsa me@mysite.com -vvv is as follows:



OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to mysite.com port 22.
ssh: connect to host mysite.com port 22: Operation timed out




  • Thinking it may be a firewall issue, I have tested with multiple ISPs but have gotten the same problem.

  • I tried running the netstat -ntlp | grep ssh command on the Terminal that sits within the CPanel GUI (I don't know how else I could run this) but it did not recognise the netstat command.










share|improve this question





























    1














    I want to start using SSH instead of FTP, but I am clueless when it comes to SSH keys.



    I'd like to use a Gulp command to transfer my files (as I do now with FTP). I've found a good amount of NPM packages that do this. However, none explain how to actually set up SSH keys on my remote shared (LAMP) server and on my local machine (MacOS).



    Would anyone know how to set this up? All the tutorials I've found deal with setting up the node.js package, not the SSH keys themselves.



    Update with additional information




    • The server is Linux. It is a cheap shared LAMP stack server running CPanel

    • I am able to only access the server via CPanel and FileZilla FTP (but not SFTP)

    • The output of running ssh -i ~/.ssh/id_rsa me@mysite.com -vvv is as follows:



    OpenSSH_7.9p1, LibreSSL 2.7.3
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 48: Applying options for *
    debug1: Connecting to mysite.com port 22.
    ssh: connect to host mysite.com port 22: Operation timed out




    • Thinking it may be a firewall issue, I have tested with multiple ISPs but have gotten the same problem.

    • I tried running the netstat -ntlp | grep ssh command on the Terminal that sits within the CPanel GUI (I don't know how else I could run this) but it did not recognise the netstat command.










    share|improve this question



























      1












      1








      1


      1





      I want to start using SSH instead of FTP, but I am clueless when it comes to SSH keys.



      I'd like to use a Gulp command to transfer my files (as I do now with FTP). I've found a good amount of NPM packages that do this. However, none explain how to actually set up SSH keys on my remote shared (LAMP) server and on my local machine (MacOS).



      Would anyone know how to set this up? All the tutorials I've found deal with setting up the node.js package, not the SSH keys themselves.



      Update with additional information




      • The server is Linux. It is a cheap shared LAMP stack server running CPanel

      • I am able to only access the server via CPanel and FileZilla FTP (but not SFTP)

      • The output of running ssh -i ~/.ssh/id_rsa me@mysite.com -vvv is as follows:



      OpenSSH_7.9p1, LibreSSL 2.7.3
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 48: Applying options for *
      debug1: Connecting to mysite.com port 22.
      ssh: connect to host mysite.com port 22: Operation timed out




      • Thinking it may be a firewall issue, I have tested with multiple ISPs but have gotten the same problem.

      • I tried running the netstat -ntlp | grep ssh command on the Terminal that sits within the CPanel GUI (I don't know how else I could run this) but it did not recognise the netstat command.










      share|improve this question















      I want to start using SSH instead of FTP, but I am clueless when it comes to SSH keys.



      I'd like to use a Gulp command to transfer my files (as I do now with FTP). I've found a good amount of NPM packages that do this. However, none explain how to actually set up SSH keys on my remote shared (LAMP) server and on my local machine (MacOS).



      Would anyone know how to set this up? All the tutorials I've found deal with setting up the node.js package, not the SSH keys themselves.



      Update with additional information




      • The server is Linux. It is a cheap shared LAMP stack server running CPanel

      • I am able to only access the server via CPanel and FileZilla FTP (but not SFTP)

      • The output of running ssh -i ~/.ssh/id_rsa me@mysite.com -vvv is as follows:



      OpenSSH_7.9p1, LibreSSL 2.7.3
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 48: Applying options for *
      debug1: Connecting to mysite.com port 22.
      ssh: connect to host mysite.com port 22: Operation timed out




      • Thinking it may be a firewall issue, I have tested with multiple ISPs but have gotten the same problem.

      • I tried running the netstat -ntlp | grep ssh command on the Terminal that sits within the CPanel GUI (I don't know how else I could run this) but it did not recognise the netstat command.







      ftp ssh gulp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 23:25







      MeltingDog

















      asked Dec 30 '18 at 11:45









      MeltingDogMeltingDog

      66411428




      66411428






















          2 Answers
          2






          active

          oldest

          votes


















          3















          • Perhaps, this article might interest you. However, before following this article, it would be nice to setup the SSH trust first.

          • So, the problem statement is, you want to copy some files from your local machine to a remote server.

          • To do that, you have to first chose an authentication method. Assuming the remote server is Linux, you've got two options - Password based and Password Less a.k.a SSH Key based authentication.

          • For the remote server to authenticate you, these are the steps which need to happen

          • You create an SSH keypair (Private Key + Public Key) on your local machine.

          • You just copy/append the contents public key from your local machine to the .ssh/authorized_keys file of the remote server.

          • Now, when you will try to SSH to the remote server from your local machine, you will specify in the command that you are trying to authenticate with the private key file that you already have created in the first step and the authentication will be successful since you have imported the corresponding public key to the remote server's authorized_keys file.


          • First, lets create keypair:
            ssh-keygen -t rsa and then select all default options by just pressing Enter key.


          • In the output of the above command, you will see that the private and public key files will be generated e.g.:
            Your identification has been saved in /home/ec2-user/.ssh/id_rsa
            Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub

          • Now, just copy/append the id_rsa.pub's CONTENT file from the directory mentioned in your case to the ~/.ssh/authorized_keys.

          • To confirm that the SSH trust has been established, just try to SSH from your local machine to the remote server by using this command - ssh -i /location/of/private/key username@remote_server_ip

          • If everything's good and you are able to login, then you just have to follow the link I mentioned in the first line of this post.






          share|improve this answer























          • Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
            – MeltingDog
            Jan 1 at 9:16










          • Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
            – st_rt_dl_8
            Jan 1 at 9:37












          • Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
            – MeltingDog
            Jan 1 at 10:11



















          1















          • Perhaps we need to backtrack and try to understand the context a little more. The following answers would be helpful. As mentioned earlier, the steps I suggested were based on my assumption that the remote server is Linux.

          • What is the OS on the remote server?

          • Are you able to login to the remote server?

          • When you run that command ssh -i ~/.ssh/id_rsa me@mysite.com run it with -vvv flag. This runs the SSH into debug mode often revealing some more information on what's happening under the hood. A sample command is ssh -i ~/.ssh/id_rsa me@mysite.com -vvv. Let us know the output.


          • Once again, assuming the remote server is linux, there are following possibilities:-

          • The sshd server on the remote machine is listening on some other port than the default TCP 22.

          • To check this, you can logon to the remote machine and run sudo netstat -ntlp | grep ssh. It will show you the port on which the SSH server is listening for SSH connections.

          • If you see that SSH is listening on some other port than TCP 22, you need to add -p flag in that ssh command. The sample command in that would be ssh -p port_number_on_which_SSH_server_is_listening -i ~/.ssh/id_rsa me@mysite.com -vvv

          • If there's no output of the above command, that means the SSH is not running on the remote server and this is the reason you are not able to SSH into it.*

          • I also have a remote instance to which I was able to connect using the same command. I was able to replicate/reproduce the issue when I disabled my SSH access to that instance and ran the SSH command in debug mode. This is the output I got (You are also getting the same error):



          $ ssh -i /c/Users/XXX/ssh-keys/sl.pem ec2-user@13.233.220.64 -vv
          OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
          debug1: Reading configuration data /etc/ssh/ssh_config
          debug2: resolving "13.233.220.64" port 22
          debug2: ssh_connect_direct: needpriv 0
          debug1: Connecting to 13.233.220.64 [13.233.220.64] port 22.
          debug1: connect to address 13.233.220.64 port 22: Connection timed out
          ssh: connect to host 13.233.220.64 port 22: Connection timed out






          share|improve this answer










          New contributor




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


















          • Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
            – MeltingDog
            Jan 1 at 23:26












          • In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
            – st_rt_dl_8
            Jan 2 at 22:26













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "45"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2fwebmasters.stackexchange.com%2fquestions%2f119945%2fhow-do-i-set-up-my-ssh-keys-so-i-can-copy-files-from-my-local-pc-to-a-remote-sha%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









          3















          • Perhaps, this article might interest you. However, before following this article, it would be nice to setup the SSH trust first.

          • So, the problem statement is, you want to copy some files from your local machine to a remote server.

          • To do that, you have to first chose an authentication method. Assuming the remote server is Linux, you've got two options - Password based and Password Less a.k.a SSH Key based authentication.

          • For the remote server to authenticate you, these are the steps which need to happen

          • You create an SSH keypair (Private Key + Public Key) on your local machine.

          • You just copy/append the contents public key from your local machine to the .ssh/authorized_keys file of the remote server.

          • Now, when you will try to SSH to the remote server from your local machine, you will specify in the command that you are trying to authenticate with the private key file that you already have created in the first step and the authentication will be successful since you have imported the corresponding public key to the remote server's authorized_keys file.


          • First, lets create keypair:
            ssh-keygen -t rsa and then select all default options by just pressing Enter key.


          • In the output of the above command, you will see that the private and public key files will be generated e.g.:
            Your identification has been saved in /home/ec2-user/.ssh/id_rsa
            Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub

          • Now, just copy/append the id_rsa.pub's CONTENT file from the directory mentioned in your case to the ~/.ssh/authorized_keys.

          • To confirm that the SSH trust has been established, just try to SSH from your local machine to the remote server by using this command - ssh -i /location/of/private/key username@remote_server_ip

          • If everything's good and you are able to login, then you just have to follow the link I mentioned in the first line of this post.






          share|improve this answer























          • Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
            – MeltingDog
            Jan 1 at 9:16










          • Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
            – st_rt_dl_8
            Jan 1 at 9:37












          • Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
            – MeltingDog
            Jan 1 at 10:11
















          3















          • Perhaps, this article might interest you. However, before following this article, it would be nice to setup the SSH trust first.

          • So, the problem statement is, you want to copy some files from your local machine to a remote server.

          • To do that, you have to first chose an authentication method. Assuming the remote server is Linux, you've got two options - Password based and Password Less a.k.a SSH Key based authentication.

          • For the remote server to authenticate you, these are the steps which need to happen

          • You create an SSH keypair (Private Key + Public Key) on your local machine.

          • You just copy/append the contents public key from your local machine to the .ssh/authorized_keys file of the remote server.

          • Now, when you will try to SSH to the remote server from your local machine, you will specify in the command that you are trying to authenticate with the private key file that you already have created in the first step and the authentication will be successful since you have imported the corresponding public key to the remote server's authorized_keys file.


          • First, lets create keypair:
            ssh-keygen -t rsa and then select all default options by just pressing Enter key.


          • In the output of the above command, you will see that the private and public key files will be generated e.g.:
            Your identification has been saved in /home/ec2-user/.ssh/id_rsa
            Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub

          • Now, just copy/append the id_rsa.pub's CONTENT file from the directory mentioned in your case to the ~/.ssh/authorized_keys.

          • To confirm that the SSH trust has been established, just try to SSH from your local machine to the remote server by using this command - ssh -i /location/of/private/key username@remote_server_ip

          • If everything's good and you are able to login, then you just have to follow the link I mentioned in the first line of this post.






          share|improve this answer























          • Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
            – MeltingDog
            Jan 1 at 9:16










          • Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
            – st_rt_dl_8
            Jan 1 at 9:37












          • Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
            – MeltingDog
            Jan 1 at 10:11














          3












          3








          3







          • Perhaps, this article might interest you. However, before following this article, it would be nice to setup the SSH trust first.

          • So, the problem statement is, you want to copy some files from your local machine to a remote server.

          • To do that, you have to first chose an authentication method. Assuming the remote server is Linux, you've got two options - Password based and Password Less a.k.a SSH Key based authentication.

          • For the remote server to authenticate you, these are the steps which need to happen

          • You create an SSH keypair (Private Key + Public Key) on your local machine.

          • You just copy/append the contents public key from your local machine to the .ssh/authorized_keys file of the remote server.

          • Now, when you will try to SSH to the remote server from your local machine, you will specify in the command that you are trying to authenticate with the private key file that you already have created in the first step and the authentication will be successful since you have imported the corresponding public key to the remote server's authorized_keys file.


          • First, lets create keypair:
            ssh-keygen -t rsa and then select all default options by just pressing Enter key.


          • In the output of the above command, you will see that the private and public key files will be generated e.g.:
            Your identification has been saved in /home/ec2-user/.ssh/id_rsa
            Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub

          • Now, just copy/append the id_rsa.pub's CONTENT file from the directory mentioned in your case to the ~/.ssh/authorized_keys.

          • To confirm that the SSH trust has been established, just try to SSH from your local machine to the remote server by using this command - ssh -i /location/of/private/key username@remote_server_ip

          • If everything's good and you are able to login, then you just have to follow the link I mentioned in the first line of this post.






          share|improve this answer















          • Perhaps, this article might interest you. However, before following this article, it would be nice to setup the SSH trust first.

          • So, the problem statement is, you want to copy some files from your local machine to a remote server.

          • To do that, you have to first chose an authentication method. Assuming the remote server is Linux, you've got two options - Password based and Password Less a.k.a SSH Key based authentication.

          • For the remote server to authenticate you, these are the steps which need to happen

          • You create an SSH keypair (Private Key + Public Key) on your local machine.

          • You just copy/append the contents public key from your local machine to the .ssh/authorized_keys file of the remote server.

          • Now, when you will try to SSH to the remote server from your local machine, you will specify in the command that you are trying to authenticate with the private key file that you already have created in the first step and the authentication will be successful since you have imported the corresponding public key to the remote server's authorized_keys file.


          • First, lets create keypair:
            ssh-keygen -t rsa and then select all default options by just pressing Enter key.


          • In the output of the above command, you will see that the private and public key files will be generated e.g.:
            Your identification has been saved in /home/ec2-user/.ssh/id_rsa
            Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub

          • Now, just copy/append the id_rsa.pub's CONTENT file from the directory mentioned in your case to the ~/.ssh/authorized_keys.

          • To confirm that the SSH trust has been established, just try to SSH from your local machine to the remote server by using this command - ssh -i /location/of/private/key username@remote_server_ip

          • If everything's good and you are able to login, then you just have to follow the link I mentioned in the first line of this post.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 30 '18 at 12:22









          Stephen Ostermiller

          66.9k1391244




          66.9k1391244










          answered Dec 30 '18 at 12:16









          st_rt_dl_8st_rt_dl_8

          663




          663












          • Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
            – MeltingDog
            Jan 1 at 9:16










          • Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
            – st_rt_dl_8
            Jan 1 at 9:37












          • Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
            – MeltingDog
            Jan 1 at 10:11


















          • Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
            – MeltingDog
            Jan 1 at 9:16










          • Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
            – st_rt_dl_8
            Jan 1 at 9:37












          • Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
            – MeltingDog
            Jan 1 at 10:11
















          Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
          – MeltingDog
          Jan 1 at 9:16




          Thanks, but I am still having difficulties. When I run ssh -i ~/.ssh me@mysite.com I just get the error ssh: connect to host mysite.com port 22: Operation timed out
          – MeltingDog
          Jan 1 at 9:16












          Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
          – st_rt_dl_8
          Jan 1 at 9:37






          Looks like you did not specify the absolute/relative path pf the private key in the -i flag. From the command you have mentioned, you are referencing to a folder (.ssh) and not the private key file. Please note a sample command below: ssh -i ~/.ssh/id_rsa username@remote_server_ip
          – st_rt_dl_8
          Jan 1 at 9:37














          Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
          – MeltingDog
          Jan 1 at 10:11




          Sorry but I get the same error. How do you know what username to use (I mean, how do you get the value username@remote_server_ip?)
          – MeltingDog
          Jan 1 at 10:11













          1















          • Perhaps we need to backtrack and try to understand the context a little more. The following answers would be helpful. As mentioned earlier, the steps I suggested were based on my assumption that the remote server is Linux.

          • What is the OS on the remote server?

          • Are you able to login to the remote server?

          • When you run that command ssh -i ~/.ssh/id_rsa me@mysite.com run it with -vvv flag. This runs the SSH into debug mode often revealing some more information on what's happening under the hood. A sample command is ssh -i ~/.ssh/id_rsa me@mysite.com -vvv. Let us know the output.


          • Once again, assuming the remote server is linux, there are following possibilities:-

          • The sshd server on the remote machine is listening on some other port than the default TCP 22.

          • To check this, you can logon to the remote machine and run sudo netstat -ntlp | grep ssh. It will show you the port on which the SSH server is listening for SSH connections.

          • If you see that SSH is listening on some other port than TCP 22, you need to add -p flag in that ssh command. The sample command in that would be ssh -p port_number_on_which_SSH_server_is_listening -i ~/.ssh/id_rsa me@mysite.com -vvv

          • If there's no output of the above command, that means the SSH is not running on the remote server and this is the reason you are not able to SSH into it.*

          • I also have a remote instance to which I was able to connect using the same command. I was able to replicate/reproduce the issue when I disabled my SSH access to that instance and ran the SSH command in debug mode. This is the output I got (You are also getting the same error):



          $ ssh -i /c/Users/XXX/ssh-keys/sl.pem ec2-user@13.233.220.64 -vv
          OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
          debug1: Reading configuration data /etc/ssh/ssh_config
          debug2: resolving "13.233.220.64" port 22
          debug2: ssh_connect_direct: needpriv 0
          debug1: Connecting to 13.233.220.64 [13.233.220.64] port 22.
          debug1: connect to address 13.233.220.64 port 22: Connection timed out
          ssh: connect to host 13.233.220.64 port 22: Connection timed out






          share|improve this answer










          New contributor




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


















          • Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
            – MeltingDog
            Jan 1 at 23:26












          • In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
            – st_rt_dl_8
            Jan 2 at 22:26


















          1















          • Perhaps we need to backtrack and try to understand the context a little more. The following answers would be helpful. As mentioned earlier, the steps I suggested were based on my assumption that the remote server is Linux.

          • What is the OS on the remote server?

          • Are you able to login to the remote server?

          • When you run that command ssh -i ~/.ssh/id_rsa me@mysite.com run it with -vvv flag. This runs the SSH into debug mode often revealing some more information on what's happening under the hood. A sample command is ssh -i ~/.ssh/id_rsa me@mysite.com -vvv. Let us know the output.


          • Once again, assuming the remote server is linux, there are following possibilities:-

          • The sshd server on the remote machine is listening on some other port than the default TCP 22.

          • To check this, you can logon to the remote machine and run sudo netstat -ntlp | grep ssh. It will show you the port on which the SSH server is listening for SSH connections.

          • If you see that SSH is listening on some other port than TCP 22, you need to add -p flag in that ssh command. The sample command in that would be ssh -p port_number_on_which_SSH_server_is_listening -i ~/.ssh/id_rsa me@mysite.com -vvv

          • If there's no output of the above command, that means the SSH is not running on the remote server and this is the reason you are not able to SSH into it.*

          • I also have a remote instance to which I was able to connect using the same command. I was able to replicate/reproduce the issue when I disabled my SSH access to that instance and ran the SSH command in debug mode. This is the output I got (You are also getting the same error):



          $ ssh -i /c/Users/XXX/ssh-keys/sl.pem ec2-user@13.233.220.64 -vv
          OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
          debug1: Reading configuration data /etc/ssh/ssh_config
          debug2: resolving "13.233.220.64" port 22
          debug2: ssh_connect_direct: needpriv 0
          debug1: Connecting to 13.233.220.64 [13.233.220.64] port 22.
          debug1: connect to address 13.233.220.64 port 22: Connection timed out
          ssh: connect to host 13.233.220.64 port 22: Connection timed out






          share|improve this answer










          New contributor




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


















          • Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
            – MeltingDog
            Jan 1 at 23:26












          • In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
            – st_rt_dl_8
            Jan 2 at 22:26
















          1












          1








          1







          • Perhaps we need to backtrack and try to understand the context a little more. The following answers would be helpful. As mentioned earlier, the steps I suggested were based on my assumption that the remote server is Linux.

          • What is the OS on the remote server?

          • Are you able to login to the remote server?

          • When you run that command ssh -i ~/.ssh/id_rsa me@mysite.com run it with -vvv flag. This runs the SSH into debug mode often revealing some more information on what's happening under the hood. A sample command is ssh -i ~/.ssh/id_rsa me@mysite.com -vvv. Let us know the output.


          • Once again, assuming the remote server is linux, there are following possibilities:-

          • The sshd server on the remote machine is listening on some other port than the default TCP 22.

          • To check this, you can logon to the remote machine and run sudo netstat -ntlp | grep ssh. It will show you the port on which the SSH server is listening for SSH connections.

          • If you see that SSH is listening on some other port than TCP 22, you need to add -p flag in that ssh command. The sample command in that would be ssh -p port_number_on_which_SSH_server_is_listening -i ~/.ssh/id_rsa me@mysite.com -vvv

          • If there's no output of the above command, that means the SSH is not running on the remote server and this is the reason you are not able to SSH into it.*

          • I also have a remote instance to which I was able to connect using the same command. I was able to replicate/reproduce the issue when I disabled my SSH access to that instance and ran the SSH command in debug mode. This is the output I got (You are also getting the same error):



          $ ssh -i /c/Users/XXX/ssh-keys/sl.pem ec2-user@13.233.220.64 -vv
          OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
          debug1: Reading configuration data /etc/ssh/ssh_config
          debug2: resolving "13.233.220.64" port 22
          debug2: ssh_connect_direct: needpriv 0
          debug1: Connecting to 13.233.220.64 [13.233.220.64] port 22.
          debug1: connect to address 13.233.220.64 port 22: Connection timed out
          ssh: connect to host 13.233.220.64 port 22: Connection timed out






          share|improve this answer










          New contributor




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










          • Perhaps we need to backtrack and try to understand the context a little more. The following answers would be helpful. As mentioned earlier, the steps I suggested were based on my assumption that the remote server is Linux.

          • What is the OS on the remote server?

          • Are you able to login to the remote server?

          • When you run that command ssh -i ~/.ssh/id_rsa me@mysite.com run it with -vvv flag. This runs the SSH into debug mode often revealing some more information on what's happening under the hood. A sample command is ssh -i ~/.ssh/id_rsa me@mysite.com -vvv. Let us know the output.


          • Once again, assuming the remote server is linux, there are following possibilities:-

          • The sshd server on the remote machine is listening on some other port than the default TCP 22.

          • To check this, you can logon to the remote machine and run sudo netstat -ntlp | grep ssh. It will show you the port on which the SSH server is listening for SSH connections.

          • If you see that SSH is listening on some other port than TCP 22, you need to add -p flag in that ssh command. The sample command in that would be ssh -p port_number_on_which_SSH_server_is_listening -i ~/.ssh/id_rsa me@mysite.com -vvv

          • If there's no output of the above command, that means the SSH is not running on the remote server and this is the reason you are not able to SSH into it.*

          • I also have a remote instance to which I was able to connect using the same command. I was able to replicate/reproduce the issue when I disabled my SSH access to that instance and ran the SSH command in debug mode. This is the output I got (You are also getting the same error):



          $ ssh -i /c/Users/XXX/ssh-keys/sl.pem ec2-user@13.233.220.64 -vv
          OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
          debug1: Reading configuration data /etc/ssh/ssh_config
          debug2: resolving "13.233.220.64" port 22
          debug2: ssh_connect_direct: needpriv 0
          debug1: Connecting to 13.233.220.64 [13.233.220.64] port 22.
          debug1: connect to address 13.233.220.64 port 22: Connection timed out
          ssh: connect to host 13.233.220.64 port 22: Connection timed out







          share|improve this answer










          New contributor




          st_rt_dl_8 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








          edited Jan 1 at 14:40





















          New contributor




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









          answered Jan 1 at 14:22









          st_rt_dl_8st_rt_dl_8

          663




          663




          New contributor




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





          New contributor





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






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












          • Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
            – MeltingDog
            Jan 1 at 23:26












          • In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
            – st_rt_dl_8
            Jan 2 at 22:26




















          • Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
            – MeltingDog
            Jan 1 at 23:26












          • In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
            – st_rt_dl_8
            Jan 2 at 22:26


















          Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
          – MeltingDog
          Jan 1 at 23:26






          Thanks, I have updated my question above with more information. I have a feeling the SSH is not available on my server or that the port is blocked.
          – MeltingDog
          Jan 1 at 23:26














          In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
          – st_rt_dl_8
          Jan 2 at 22:26






          In that case, can you try allowing SSH access from your cPanel -> Advanced Section -> SSH/Shell Access ? See if you can follow this article If you are able to follow this until end, you will have the private key which you need to use while connecting with SSH command - ssh -i (path to your private key that you would download in the last step). Then the last thing you would need to find out is the port on which your remote server is listening for inbound SSH connections.
          – st_rt_dl_8
          Jan 2 at 22:26




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Webmasters Stack Exchange!


          • 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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2fwebmasters.stackexchange.com%2fquestions%2f119945%2fhow-do-i-set-up-my-ssh-keys-so-i-can-copy-files-from-my-local-pc-to-a-remote-sha%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

          How to send String Array data to Server using php in android

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Is anime1.com a legal site for watching anime?