Use scp to transfer a file from local directory X to remote directory Y











up vote
72
down vote

favorite
28












I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong.



I'm using Linux Mint and I'm trying to figure out how scp works.



I've a file file.ext (on my computer) in directory /home/name/dir/



I connect to a remote machine using ssh, like:



ssh -p 2222 username@domain


it asks me the password and the shell displays:



username@domain ~ $


now, If I issue the command (before I ran ssh I was in the local directory /home/name/dir ):



scp -r -P 2222 file.ext username@domain 


output is:



cp: cannot stat ‘file.ext’: No such file or directory


Same result if instead of file.ext I write the complete path



scp -r -P 2222 /home/name/dir/file.ext username@domain 


Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:



scp -r -P 2222 file.ext username@domain:~/


but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input.



Summary of my problems:




  • cp: no such file or directory

  • shell "stuck" on ~/


Any suggestions?










share|improve this question
























  • it's slightly unclear whether your problem is only related to being on the wrong machine...could you please prefix each command with the host you are running on? e.g. localuser@machineA: ssh -p 2222 username@domain (to indicate that you are running the ssh command as localuser on machineA)
    – umläute
    Feb 17 '14 at 16:09












  • when using scp, the remote side always has to contain the colon (e.g. remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.com will copy /tmp/foo.txt into a local file example.com)
    – umläute
    Feb 17 '14 at 16:11










  • remove the -r flag, as this is not needed for copying single files (it's used to recursively copy directories)
    – umläute
    Feb 17 '14 at 16:12










  • Are you issuing the scp command inside the sshe session? It would make sense if you are on the local machine.
    – alexis
    Feb 17 '14 at 16:13






  • 1




    scp -P 2222 file.ext username@hostname-or-ip_address:/remote/path/
    – Christopher
    Feb 17 '14 at 16:14

















up vote
72
down vote

favorite
28












I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong.



I'm using Linux Mint and I'm trying to figure out how scp works.



I've a file file.ext (on my computer) in directory /home/name/dir/



I connect to a remote machine using ssh, like:



ssh -p 2222 username@domain


it asks me the password and the shell displays:



username@domain ~ $


now, If I issue the command (before I ran ssh I was in the local directory /home/name/dir ):



scp -r -P 2222 file.ext username@domain 


output is:



cp: cannot stat ‘file.ext’: No such file or directory


Same result if instead of file.ext I write the complete path



scp -r -P 2222 /home/name/dir/file.ext username@domain 


Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:



scp -r -P 2222 file.ext username@domain:~/


but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input.



Summary of my problems:




  • cp: no such file or directory

  • shell "stuck" on ~/


Any suggestions?










share|improve this question
























  • it's slightly unclear whether your problem is only related to being on the wrong machine...could you please prefix each command with the host you are running on? e.g. localuser@machineA: ssh -p 2222 username@domain (to indicate that you are running the ssh command as localuser on machineA)
    – umläute
    Feb 17 '14 at 16:09












  • when using scp, the remote side always has to contain the colon (e.g. remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.com will copy /tmp/foo.txt into a local file example.com)
    – umläute
    Feb 17 '14 at 16:11










  • remove the -r flag, as this is not needed for copying single files (it's used to recursively copy directories)
    – umläute
    Feb 17 '14 at 16:12










  • Are you issuing the scp command inside the sshe session? It would make sense if you are on the local machine.
    – alexis
    Feb 17 '14 at 16:13






  • 1




    scp -P 2222 file.ext username@hostname-or-ip_address:/remote/path/
    – Christopher
    Feb 17 '14 at 16:14















up vote
72
down vote

favorite
28









up vote
72
down vote

favorite
28






28





I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong.



I'm using Linux Mint and I'm trying to figure out how scp works.



I've a file file.ext (on my computer) in directory /home/name/dir/



I connect to a remote machine using ssh, like:



ssh -p 2222 username@domain


it asks me the password and the shell displays:



username@domain ~ $


now, If I issue the command (before I ran ssh I was in the local directory /home/name/dir ):



scp -r -P 2222 file.ext username@domain 


output is:



cp: cannot stat ‘file.ext’: No such file or directory


Same result if instead of file.ext I write the complete path



scp -r -P 2222 /home/name/dir/file.ext username@domain 


Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:



scp -r -P 2222 file.ext username@domain:~/


but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input.



Summary of my problems:




  • cp: no such file or directory

  • shell "stuck" on ~/


Any suggestions?










share|improve this question















I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong.



I'm using Linux Mint and I'm trying to figure out how scp works.



I've a file file.ext (on my computer) in directory /home/name/dir/



I connect to a remote machine using ssh, like:



ssh -p 2222 username@domain


it asks me the password and the shell displays:



username@domain ~ $


now, If I issue the command (before I ran ssh I was in the local directory /home/name/dir ):



scp -r -P 2222 file.ext username@domain 


output is:



cp: cannot stat ‘file.ext’: No such file or directory


Same result if instead of file.ext I write the complete path



scp -r -P 2222 /home/name/dir/file.ext username@domain 


Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:



scp -r -P 2222 file.ext username@domain:~/


but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input.



Summary of my problems:




  • cp: no such file or directory

  • shell "stuck" on ~/


Any suggestions?







scp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 19 '14 at 6:40









Timo

4,7251726




4,7251726










asked Feb 17 '14 at 15:58









dragonmnl

64421020




64421020












  • it's slightly unclear whether your problem is only related to being on the wrong machine...could you please prefix each command with the host you are running on? e.g. localuser@machineA: ssh -p 2222 username@domain (to indicate that you are running the ssh command as localuser on machineA)
    – umläute
    Feb 17 '14 at 16:09












  • when using scp, the remote side always has to contain the colon (e.g. remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.com will copy /tmp/foo.txt into a local file example.com)
    – umläute
    Feb 17 '14 at 16:11










  • remove the -r flag, as this is not needed for copying single files (it's used to recursively copy directories)
    – umläute
    Feb 17 '14 at 16:12










  • Are you issuing the scp command inside the sshe session? It would make sense if you are on the local machine.
    – alexis
    Feb 17 '14 at 16:13






  • 1




    scp -P 2222 file.ext username@hostname-or-ip_address:/remote/path/
    – Christopher
    Feb 17 '14 at 16:14




















  • it's slightly unclear whether your problem is only related to being on the wrong machine...could you please prefix each command with the host you are running on? e.g. localuser@machineA: ssh -p 2222 username@domain (to indicate that you are running the ssh command as localuser on machineA)
    – umläute
    Feb 17 '14 at 16:09












  • when using scp, the remote side always has to contain the colon (e.g. remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.com will copy /tmp/foo.txt into a local file example.com)
    – umläute
    Feb 17 '14 at 16:11










  • remove the -r flag, as this is not needed for copying single files (it's used to recursively copy directories)
    – umläute
    Feb 17 '14 at 16:12










  • Are you issuing the scp command inside the sshe session? It would make sense if you are on the local machine.
    – alexis
    Feb 17 '14 at 16:13






  • 1




    scp -P 2222 file.ext username@hostname-or-ip_address:/remote/path/
    – Christopher
    Feb 17 '14 at 16:14


















it's slightly unclear whether your problem is only related to being on the wrong machine...could you please prefix each command with the host you are running on? e.g. localuser@machineA: ssh -p 2222 username@domain (to indicate that you are running the ssh command as localuser on machineA)
– umläute
Feb 17 '14 at 16:09






it's slightly unclear whether your problem is only related to being on the wrong machine...could you please prefix each command with the host you are running on? e.g. localuser@machineA: ssh -p 2222 username@domain (to indicate that you are running the ssh command as localuser on machineA)
– umläute
Feb 17 '14 at 16:09














when using scp, the remote side always has to contain the colon (e.g. remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.com will copy /tmp/foo.txt into a local file example.com)
– umläute
Feb 17 '14 at 16:11




when using scp, the remote side always has to contain the colon (e.g. remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.com will copy /tmp/foo.txt into a local file example.com)
– umläute
Feb 17 '14 at 16:11












remove the -r flag, as this is not needed for copying single files (it's used to recursively copy directories)
– umläute
Feb 17 '14 at 16:12




remove the -r flag, as this is not needed for copying single files (it's used to recursively copy directories)
– umläute
Feb 17 '14 at 16:12












Are you issuing the scp command inside the sshe session? It would make sense if you are on the local machine.
– alexis
Feb 17 '14 at 16:13




Are you issuing the scp command inside the sshe session? It would make sense if you are on the local machine.
– alexis
Feb 17 '14 at 16:13




1




1




scp -P 2222 file.ext username@hostname-or-ip_address:/remote/path/
– Christopher
Feb 17 '14 at 16:14






scp -P 2222 file.ext username@hostname-or-ip_address:/remote/path/
– Christopher
Feb 17 '14 at 16:14












8 Answers
8






active

oldest

votes

















up vote
90
down vote



accepted










You need to run the scp command from the local machine, not on the remote. You don't need the ssh at all:



dragonmnl@local $ scp -P 2222 file.ext username@domain:~/ 


You also don't need the -r:



 -r      Recursively copy entire directories.  


If you are already logged into the remote machine and want to copy from your local, you need to make sure that your local machine is accessible via the internet and has ssh set up. I don't think this is what you are after but if it is, just run this from the remote:



username@domain $ scp dragonmnl@local:/path/to/file.ext ~/





share|improve this answer

















  • 1




    thanks. the problem was I was trying running scp inside ssh session. now it works!
    – dragonmnl
    Feb 17 '14 at 16:19


















up vote
21
down vote













I provide two methods of up/down load file between remote and local machine(I use Mac air):



In this case, I want to up/down "11.jpeg " between local and remote:



1.




Copy files on service to local dir: You must be in local bash terminal to conduct this command, not when you are in ssh!




scp username@domain:/home/xxx/xxx/11.jpeg /Users/username/Desktop/  



copy files in local dir to remote service : also you must be in local bash terminal




scp /Users/username/Desktop/11.jpeg username@domain:/home/xxx/xxx




  1. To achieve the same intention when you are logging in the SSH, you must first set “System Preferences>sharing>remote log in>all users(I am not sure if you must set for "all users", but it works in this situation)” the Mac will tell you"To log in to this computer remotely, type : ssh username@xxxxxx, then type in the command below:



    scp username@domain:/home/xxx/xxx/11.jpeg username@xxxxxx:/Users/username/Desktop/




This command above is for downloading file from remote to local when you are logging into ssh, Just change the two path when you want to upload file .






share|improve this answer























  • Finally, I find Filezilla is probably the most convenient one in daily work~~
    – maizer
    Aug 14 at 19:57




















up vote
3
down vote













If you're running this scp command on the remote machine, it is looking for file.ext as a "local" file, i.e. on the remote machine.



To copy a file from the remote machine to the local one, use scp -P 2222 username@domain:dir/file.ext localdir (assuming that file.ext is in ~/dir on the remote computer, as in your example). If you run scp on the remote machine, reverse "local" and "remote".






share|improve this answer



















  • 1




    The OP wants to copy from local to remote, see the OP's title.
    – terdon
    Feb 17 '14 at 16:10










  • Oops, I guess you're right. But he's apparently doing it backwards...
    – alexis
    Feb 17 '14 at 16:15


















up vote
2
down vote













Use the scp command



If you want to transfer a folder, just zip it first, we can unzip it later on.



From your computer, run this:



$ scp your_path_to_the_file/the_file root@10.145.198.100:~/


Here, root is your account, and 10.145.198.100 is the remote server's IP address. We're going to copy the_file to ~/ folder in the remote.



Unzip file:



$ unzip the_zip_file.zip -d destination_folder





share|improve this answer























  • Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
    – Kusalananda
    Jul 10 at 9:31




















up vote
0
down vote













Solution to copy files from Linux client to Linux Server




  1. Check if sshd is running on your server using:
    ps aux | grep sshd


  2. If not install OpenSSH using
    sudo apt-get install openssh-server openssh-client
    https://www.tecmint.com/install-openssh-server-in-linux/


  3. Restart your server and verify that sshd is running using
    ps aux | grep sshd


  4. If you need you can configure your /etc/ssh/sshd_config file, but its not
    necessary for simple configurations


  5. verify that the ports are open using netcat
    nc -v -z 127.0.0.1 22


  6. To copy files from a Linux client to a Linux client use scp as follows
    scp ~/filename.md username@10.22.33.45:~/folder/filename.md


  7. To verify that file has been copied use
    ssh username@10.22.33.45 and provide your password.



Solution to copy files from Linux client to `Windows





  1. There are multiple clients for running SSH servers on Windows such as
    OpenSSH from MS



    MobaSSH



    Bitvise SSH server




  2. Install one of the above servers and make sure that port 22 is open using





    netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=UDP localport=22



    netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=UDP localport=22





    netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=TCP localport=22



    netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=TCP localport=22





    netsh advfirewall set allprofiles state off




  3. Comparisons of these servers:



    Bitvise SSH server




    1. Provides almost close to native cmd prompt, powershell prompt,
      autocompletion


    2. Provides additional capabilities for customization, if you need
      advanced usage


    3. User customization for simple needs is 0. I got started on it within
      2 mins, after having spent a lot of time trying to get MobaSSH and
      OpenSSH to work.


    4. To copy files using scp use:
      scp ~/filename.md username@10.33.44.45:/C/Users/username/filename.md


    5. Free for personal use, $99 for professional use. Because of so many
      features and great integration, the price is well worth the money



    MobaSSH:




    1. provides a linux shell on windows where simple linux commands such
      as ls, cp, find etc work, similar to MINGW64


    2. you can access cmd and powershell directly by typing cmd or
      powershell


    3. Unicode support is poor. Encoding is not correct. For example if you
      try to start Python interpretor, it will crash. You will need to
      change the encoding manually using
      (https://stackoverflow.com/a/12834315/4752883):
      chcp 65001
      set PYTHONIOENCONDING=utf-8
      and then startup Python prompt


    4. The great thing about MobaSSH is that it has a very simple
      user-interface, and scp and ssh and integrated well. So will
      work for simple use cases


    5. To copy files from a Linux client to a Windows server running
      MobaSSH: use
      scp ~/filename.md
      username@10.33.44.45:/cygdrive/c/Users/username/filename.md

      This is because MobaSSH is based on cygwin and its drives are
      mapped to the same way cygwin-s drives are mapped.



    Use VMs from Microsoft with OpenSSHv6.7 installed from
    https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/,
    OpenSSHv6.7 is already installed.




    1. Its very buggy, and you will need to heavily customize it.


    2. Command completion doesnt work


    3. It will leave blank spaces when you are moving cursor on the terminal


    4. Python doesn't work


    5. Later versions of OpenSSH, may have improved on it. Further MS seems to
      make OpenSSH available via Optional Features
      https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/









share|improve this answer




























    up vote
    0
    down vote













    Just a small contribution, maybe it can help beginners like me: the path to the the remote directory should be written like this: username@domain:~/remote_directory



    What I want to highlight here is that we should always add that :~/






    share|improve this answer




























      up vote
      -1
      down vote













      If you happen to be on OSX...



      When I tried running it with username@local:/file_directory...



      I got the following error:



      ssh: local: node name or service name not known


      Solution



      On my Mac I had to do the following to setup local ssh:




      ‘System Preferences’ --> ‘Internet & Networking’ --> ‘Sharing’ --> ENABLE ‘Remote Login’




      This then provided the username@ip address.






      share|improve this answer






























        up vote
        -1
        down vote













        I had this same problem today on MAC.



        Type the following command:



        scp /local-file-path/ /-remote-location-path/





        share|improve this answer























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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',
          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%2funix.stackexchange.com%2fquestions%2f115560%2fuse-scp-to-transfer-a-file-from-local-directory-x-to-remote-directory-y%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          8 Answers
          8






          active

          oldest

          votes








          8 Answers
          8






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          90
          down vote



          accepted










          You need to run the scp command from the local machine, not on the remote. You don't need the ssh at all:



          dragonmnl@local $ scp -P 2222 file.ext username@domain:~/ 


          You also don't need the -r:



           -r      Recursively copy entire directories.  


          If you are already logged into the remote machine and want to copy from your local, you need to make sure that your local machine is accessible via the internet and has ssh set up. I don't think this is what you are after but if it is, just run this from the remote:



          username@domain $ scp dragonmnl@local:/path/to/file.ext ~/





          share|improve this answer

















          • 1




            thanks. the problem was I was trying running scp inside ssh session. now it works!
            – dragonmnl
            Feb 17 '14 at 16:19















          up vote
          90
          down vote



          accepted










          You need to run the scp command from the local machine, not on the remote. You don't need the ssh at all:



          dragonmnl@local $ scp -P 2222 file.ext username@domain:~/ 


          You also don't need the -r:



           -r      Recursively copy entire directories.  


          If you are already logged into the remote machine and want to copy from your local, you need to make sure that your local machine is accessible via the internet and has ssh set up. I don't think this is what you are after but if it is, just run this from the remote:



          username@domain $ scp dragonmnl@local:/path/to/file.ext ~/





          share|improve this answer

















          • 1




            thanks. the problem was I was trying running scp inside ssh session. now it works!
            – dragonmnl
            Feb 17 '14 at 16:19













          up vote
          90
          down vote



          accepted







          up vote
          90
          down vote



          accepted






          You need to run the scp command from the local machine, not on the remote. You don't need the ssh at all:



          dragonmnl@local $ scp -P 2222 file.ext username@domain:~/ 


          You also don't need the -r:



           -r      Recursively copy entire directories.  


          If you are already logged into the remote machine and want to copy from your local, you need to make sure that your local machine is accessible via the internet and has ssh set up. I don't think this is what you are after but if it is, just run this from the remote:



          username@domain $ scp dragonmnl@local:/path/to/file.ext ~/





          share|improve this answer












          You need to run the scp command from the local machine, not on the remote. You don't need the ssh at all:



          dragonmnl@local $ scp -P 2222 file.ext username@domain:~/ 


          You also don't need the -r:



           -r      Recursively copy entire directories.  


          If you are already logged into the remote machine and want to copy from your local, you need to make sure that your local machine is accessible via the internet and has ssh set up. I don't think this is what you are after but if it is, just run this from the remote:



          username@domain $ scp dragonmnl@local:/path/to/file.ext ~/






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 17 '14 at 16:13









          terdon

          127k31245422




          127k31245422








          • 1




            thanks. the problem was I was trying running scp inside ssh session. now it works!
            – dragonmnl
            Feb 17 '14 at 16:19














          • 1




            thanks. the problem was I was trying running scp inside ssh session. now it works!
            – dragonmnl
            Feb 17 '14 at 16:19








          1




          1




          thanks. the problem was I was trying running scp inside ssh session. now it works!
          – dragonmnl
          Feb 17 '14 at 16:19




          thanks. the problem was I was trying running scp inside ssh session. now it works!
          – dragonmnl
          Feb 17 '14 at 16:19












          up vote
          21
          down vote













          I provide two methods of up/down load file between remote and local machine(I use Mac air):



          In this case, I want to up/down "11.jpeg " between local and remote:



          1.




          Copy files on service to local dir: You must be in local bash terminal to conduct this command, not when you are in ssh!




          scp username@domain:/home/xxx/xxx/11.jpeg /Users/username/Desktop/  



          copy files in local dir to remote service : also you must be in local bash terminal




          scp /Users/username/Desktop/11.jpeg username@domain:/home/xxx/xxx




          1. To achieve the same intention when you are logging in the SSH, you must first set “System Preferences>sharing>remote log in>all users(I am not sure if you must set for "all users", but it works in this situation)” the Mac will tell you"To log in to this computer remotely, type : ssh username@xxxxxx, then type in the command below:



            scp username@domain:/home/xxx/xxx/11.jpeg username@xxxxxx:/Users/username/Desktop/




          This command above is for downloading file from remote to local when you are logging into ssh, Just change the two path when you want to upload file .






          share|improve this answer























          • Finally, I find Filezilla is probably the most convenient one in daily work~~
            – maizer
            Aug 14 at 19:57

















          up vote
          21
          down vote













          I provide two methods of up/down load file between remote and local machine(I use Mac air):



          In this case, I want to up/down "11.jpeg " between local and remote:



          1.




          Copy files on service to local dir: You must be in local bash terminal to conduct this command, not when you are in ssh!




          scp username@domain:/home/xxx/xxx/11.jpeg /Users/username/Desktop/  



          copy files in local dir to remote service : also you must be in local bash terminal




          scp /Users/username/Desktop/11.jpeg username@domain:/home/xxx/xxx




          1. To achieve the same intention when you are logging in the SSH, you must first set “System Preferences>sharing>remote log in>all users(I am not sure if you must set for "all users", but it works in this situation)” the Mac will tell you"To log in to this computer remotely, type : ssh username@xxxxxx, then type in the command below:



            scp username@domain:/home/xxx/xxx/11.jpeg username@xxxxxx:/Users/username/Desktop/




          This command above is for downloading file from remote to local when you are logging into ssh, Just change the two path when you want to upload file .






          share|improve this answer























          • Finally, I find Filezilla is probably the most convenient one in daily work~~
            – maizer
            Aug 14 at 19:57















          up vote
          21
          down vote










          up vote
          21
          down vote









          I provide two methods of up/down load file between remote and local machine(I use Mac air):



          In this case, I want to up/down "11.jpeg " between local and remote:



          1.




          Copy files on service to local dir: You must be in local bash terminal to conduct this command, not when you are in ssh!




          scp username@domain:/home/xxx/xxx/11.jpeg /Users/username/Desktop/  



          copy files in local dir to remote service : also you must be in local bash terminal




          scp /Users/username/Desktop/11.jpeg username@domain:/home/xxx/xxx




          1. To achieve the same intention when you are logging in the SSH, you must first set “System Preferences>sharing>remote log in>all users(I am not sure if you must set for "all users", but it works in this situation)” the Mac will tell you"To log in to this computer remotely, type : ssh username@xxxxxx, then type in the command below:



            scp username@domain:/home/xxx/xxx/11.jpeg username@xxxxxx:/Users/username/Desktop/




          This command above is for downloading file from remote to local when you are logging into ssh, Just change the two path when you want to upload file .






          share|improve this answer














          I provide two methods of up/down load file between remote and local machine(I use Mac air):



          In this case, I want to up/down "11.jpeg " between local and remote:



          1.




          Copy files on service to local dir: You must be in local bash terminal to conduct this command, not when you are in ssh!




          scp username@domain:/home/xxx/xxx/11.jpeg /Users/username/Desktop/  



          copy files in local dir to remote service : also you must be in local bash terminal




          scp /Users/username/Desktop/11.jpeg username@domain:/home/xxx/xxx




          1. To achieve the same intention when you are logging in the SSH, you must first set “System Preferences>sharing>remote log in>all users(I am not sure if you must set for "all users", but it works in this situation)” the Mac will tell you"To log in to this computer remotely, type : ssh username@xxxxxx, then type in the command below:



            scp username@domain:/home/xxx/xxx/11.jpeg username@xxxxxx:/Users/username/Desktop/




          This command above is for downloading file from remote to local when you are logging into ssh, Just change the two path when you want to upload file .







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 20 '16 at 20:10

























          answered Oct 20 '16 at 20:05









          maizer

          31124




          31124












          • Finally, I find Filezilla is probably the most convenient one in daily work~~
            – maizer
            Aug 14 at 19:57




















          • Finally, I find Filezilla is probably the most convenient one in daily work~~
            – maizer
            Aug 14 at 19:57


















          Finally, I find Filezilla is probably the most convenient one in daily work~~
          – maizer
          Aug 14 at 19:57






          Finally, I find Filezilla is probably the most convenient one in daily work~~
          – maizer
          Aug 14 at 19:57












          up vote
          3
          down vote













          If you're running this scp command on the remote machine, it is looking for file.ext as a "local" file, i.e. on the remote machine.



          To copy a file from the remote machine to the local one, use scp -P 2222 username@domain:dir/file.ext localdir (assuming that file.ext is in ~/dir on the remote computer, as in your example). If you run scp on the remote machine, reverse "local" and "remote".






          share|improve this answer



















          • 1




            The OP wants to copy from local to remote, see the OP's title.
            – terdon
            Feb 17 '14 at 16:10










          • Oops, I guess you're right. But he's apparently doing it backwards...
            – alexis
            Feb 17 '14 at 16:15















          up vote
          3
          down vote













          If you're running this scp command on the remote machine, it is looking for file.ext as a "local" file, i.e. on the remote machine.



          To copy a file from the remote machine to the local one, use scp -P 2222 username@domain:dir/file.ext localdir (assuming that file.ext is in ~/dir on the remote computer, as in your example). If you run scp on the remote machine, reverse "local" and "remote".






          share|improve this answer



















          • 1




            The OP wants to copy from local to remote, see the OP's title.
            – terdon
            Feb 17 '14 at 16:10










          • Oops, I guess you're right. But he's apparently doing it backwards...
            – alexis
            Feb 17 '14 at 16:15













          up vote
          3
          down vote










          up vote
          3
          down vote









          If you're running this scp command on the remote machine, it is looking for file.ext as a "local" file, i.e. on the remote machine.



          To copy a file from the remote machine to the local one, use scp -P 2222 username@domain:dir/file.ext localdir (assuming that file.ext is in ~/dir on the remote computer, as in your example). If you run scp on the remote machine, reverse "local" and "remote".






          share|improve this answer














          If you're running this scp command on the remote machine, it is looking for file.ext as a "local" file, i.e. on the remote machine.



          To copy a file from the remote machine to the local one, use scp -P 2222 username@domain:dir/file.ext localdir (assuming that file.ext is in ~/dir on the remote computer, as in your example). If you run scp on the remote machine, reverse "local" and "remote".







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 17 '14 at 16:16

























          answered Feb 17 '14 at 16:06









          alexis

          4,00021526




          4,00021526








          • 1




            The OP wants to copy from local to remote, see the OP's title.
            – terdon
            Feb 17 '14 at 16:10










          • Oops, I guess you're right. But he's apparently doing it backwards...
            – alexis
            Feb 17 '14 at 16:15














          • 1




            The OP wants to copy from local to remote, see the OP's title.
            – terdon
            Feb 17 '14 at 16:10










          • Oops, I guess you're right. But he's apparently doing it backwards...
            – alexis
            Feb 17 '14 at 16:15








          1




          1




          The OP wants to copy from local to remote, see the OP's title.
          – terdon
          Feb 17 '14 at 16:10




          The OP wants to copy from local to remote, see the OP's title.
          – terdon
          Feb 17 '14 at 16:10












          Oops, I guess you're right. But he's apparently doing it backwards...
          – alexis
          Feb 17 '14 at 16:15




          Oops, I guess you're right. But he's apparently doing it backwards...
          – alexis
          Feb 17 '14 at 16:15










          up vote
          2
          down vote













          Use the scp command



          If you want to transfer a folder, just zip it first, we can unzip it later on.



          From your computer, run this:



          $ scp your_path_to_the_file/the_file root@10.145.198.100:~/


          Here, root is your account, and 10.145.198.100 is the remote server's IP address. We're going to copy the_file to ~/ folder in the remote.



          Unzip file:



          $ unzip the_zip_file.zip -d destination_folder





          share|improve this answer























          • Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
            – Kusalananda
            Jul 10 at 9:31

















          up vote
          2
          down vote













          Use the scp command



          If you want to transfer a folder, just zip it first, we can unzip it later on.



          From your computer, run this:



          $ scp your_path_to_the_file/the_file root@10.145.198.100:~/


          Here, root is your account, and 10.145.198.100 is the remote server's IP address. We're going to copy the_file to ~/ folder in the remote.



          Unzip file:



          $ unzip the_zip_file.zip -d destination_folder





          share|improve this answer























          • Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
            – Kusalananda
            Jul 10 at 9:31















          up vote
          2
          down vote










          up vote
          2
          down vote









          Use the scp command



          If you want to transfer a folder, just zip it first, we can unzip it later on.



          From your computer, run this:



          $ scp your_path_to_the_file/the_file root@10.145.198.100:~/


          Here, root is your account, and 10.145.198.100 is the remote server's IP address. We're going to copy the_file to ~/ folder in the remote.



          Unzip file:



          $ unzip the_zip_file.zip -d destination_folder





          share|improve this answer














          Use the scp command



          If you want to transfer a folder, just zip it first, we can unzip it later on.



          From your computer, run this:



          $ scp your_path_to_the_file/the_file root@10.145.198.100:~/


          Here, root is your account, and 10.145.198.100 is the remote server's IP address. We're going to copy the_file to ~/ folder in the remote.



          Unzip file:



          $ unzip the_zip_file.zip -d destination_folder






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 10 at 8:12









          slm

          245k66505671




          245k66505671










          answered Jul 10 at 8:04









          Catbuilts

          1213




          1213












          • Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
            – Kusalananda
            Jul 10 at 9:31




















          • Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
            – Kusalananda
            Jul 10 at 9:31


















          Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
          – Kusalananda
          Jul 10 at 9:31






          Why would root even have SSH access on the remote machine? That's pretty insecure. Better to use an ordinary use and then sudo to do whatever root has to do on that machine.
          – Kusalananda
          Jul 10 at 9:31












          up vote
          0
          down vote













          Solution to copy files from Linux client to Linux Server




          1. Check if sshd is running on your server using:
            ps aux | grep sshd


          2. If not install OpenSSH using
            sudo apt-get install openssh-server openssh-client
            https://www.tecmint.com/install-openssh-server-in-linux/


          3. Restart your server and verify that sshd is running using
            ps aux | grep sshd


          4. If you need you can configure your /etc/ssh/sshd_config file, but its not
            necessary for simple configurations


          5. verify that the ports are open using netcat
            nc -v -z 127.0.0.1 22


          6. To copy files from a Linux client to a Linux client use scp as follows
            scp ~/filename.md username@10.22.33.45:~/folder/filename.md


          7. To verify that file has been copied use
            ssh username@10.22.33.45 and provide your password.



          Solution to copy files from Linux client to `Windows





          1. There are multiple clients for running SSH servers on Windows such as
            OpenSSH from MS



            MobaSSH



            Bitvise SSH server




          2. Install one of the above servers and make sure that port 22 is open using





            netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=UDP localport=22



            netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=UDP localport=22





            netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=TCP localport=22



            netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=TCP localport=22





            netsh advfirewall set allprofiles state off




          3. Comparisons of these servers:



            Bitvise SSH server




            1. Provides almost close to native cmd prompt, powershell prompt,
              autocompletion


            2. Provides additional capabilities for customization, if you need
              advanced usage


            3. User customization for simple needs is 0. I got started on it within
              2 mins, after having spent a lot of time trying to get MobaSSH and
              OpenSSH to work.


            4. To copy files using scp use:
              scp ~/filename.md username@10.33.44.45:/C/Users/username/filename.md


            5. Free for personal use, $99 for professional use. Because of so many
              features and great integration, the price is well worth the money



            MobaSSH:




            1. provides a linux shell on windows where simple linux commands such
              as ls, cp, find etc work, similar to MINGW64


            2. you can access cmd and powershell directly by typing cmd or
              powershell


            3. Unicode support is poor. Encoding is not correct. For example if you
              try to start Python interpretor, it will crash. You will need to
              change the encoding manually using
              (https://stackoverflow.com/a/12834315/4752883):
              chcp 65001
              set PYTHONIOENCONDING=utf-8
              and then startup Python prompt


            4. The great thing about MobaSSH is that it has a very simple
              user-interface, and scp and ssh and integrated well. So will
              work for simple use cases


            5. To copy files from a Linux client to a Windows server running
              MobaSSH: use
              scp ~/filename.md
              username@10.33.44.45:/cygdrive/c/Users/username/filename.md

              This is because MobaSSH is based on cygwin and its drives are
              mapped to the same way cygwin-s drives are mapped.



            Use VMs from Microsoft with OpenSSHv6.7 installed from
            https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/,
            OpenSSHv6.7 is already installed.




            1. Its very buggy, and you will need to heavily customize it.


            2. Command completion doesnt work


            3. It will leave blank spaces when you are moving cursor on the terminal


            4. Python doesn't work


            5. Later versions of OpenSSH, may have improved on it. Further MS seems to
              make OpenSSH available via Optional Features
              https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/









          share|improve this answer

























            up vote
            0
            down vote













            Solution to copy files from Linux client to Linux Server




            1. Check if sshd is running on your server using:
              ps aux | grep sshd


            2. If not install OpenSSH using
              sudo apt-get install openssh-server openssh-client
              https://www.tecmint.com/install-openssh-server-in-linux/


            3. Restart your server and verify that sshd is running using
              ps aux | grep sshd


            4. If you need you can configure your /etc/ssh/sshd_config file, but its not
              necessary for simple configurations


            5. verify that the ports are open using netcat
              nc -v -z 127.0.0.1 22


            6. To copy files from a Linux client to a Linux client use scp as follows
              scp ~/filename.md username@10.22.33.45:~/folder/filename.md


            7. To verify that file has been copied use
              ssh username@10.22.33.45 and provide your password.



            Solution to copy files from Linux client to `Windows





            1. There are multiple clients for running SSH servers on Windows such as
              OpenSSH from MS



              MobaSSH



              Bitvise SSH server




            2. Install one of the above servers and make sure that port 22 is open using





              netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=UDP localport=22



              netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=UDP localport=22





              netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=TCP localport=22



              netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=TCP localport=22





              netsh advfirewall set allprofiles state off




            3. Comparisons of these servers:



              Bitvise SSH server




              1. Provides almost close to native cmd prompt, powershell prompt,
                autocompletion


              2. Provides additional capabilities for customization, if you need
                advanced usage


              3. User customization for simple needs is 0. I got started on it within
                2 mins, after having spent a lot of time trying to get MobaSSH and
                OpenSSH to work.


              4. To copy files using scp use:
                scp ~/filename.md username@10.33.44.45:/C/Users/username/filename.md


              5. Free for personal use, $99 for professional use. Because of so many
                features and great integration, the price is well worth the money



              MobaSSH:




              1. provides a linux shell on windows where simple linux commands such
                as ls, cp, find etc work, similar to MINGW64


              2. you can access cmd and powershell directly by typing cmd or
                powershell


              3. Unicode support is poor. Encoding is not correct. For example if you
                try to start Python interpretor, it will crash. You will need to
                change the encoding manually using
                (https://stackoverflow.com/a/12834315/4752883):
                chcp 65001
                set PYTHONIOENCONDING=utf-8
                and then startup Python prompt


              4. The great thing about MobaSSH is that it has a very simple
                user-interface, and scp and ssh and integrated well. So will
                work for simple use cases


              5. To copy files from a Linux client to a Windows server running
                MobaSSH: use
                scp ~/filename.md
                username@10.33.44.45:/cygdrive/c/Users/username/filename.md

                This is because MobaSSH is based on cygwin and its drives are
                mapped to the same way cygwin-s drives are mapped.



              Use VMs from Microsoft with OpenSSHv6.7 installed from
              https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/,
              OpenSSHv6.7 is already installed.




              1. Its very buggy, and you will need to heavily customize it.


              2. Command completion doesnt work


              3. It will leave blank spaces when you are moving cursor on the terminal


              4. Python doesn't work


              5. Later versions of OpenSSH, may have improved on it. Further MS seems to
                make OpenSSH available via Optional Features
                https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/









            share|improve this answer























              up vote
              0
              down vote










              up vote
              0
              down vote









              Solution to copy files from Linux client to Linux Server




              1. Check if sshd is running on your server using:
                ps aux | grep sshd


              2. If not install OpenSSH using
                sudo apt-get install openssh-server openssh-client
                https://www.tecmint.com/install-openssh-server-in-linux/


              3. Restart your server and verify that sshd is running using
                ps aux | grep sshd


              4. If you need you can configure your /etc/ssh/sshd_config file, but its not
                necessary for simple configurations


              5. verify that the ports are open using netcat
                nc -v -z 127.0.0.1 22


              6. To copy files from a Linux client to a Linux client use scp as follows
                scp ~/filename.md username@10.22.33.45:~/folder/filename.md


              7. To verify that file has been copied use
                ssh username@10.22.33.45 and provide your password.



              Solution to copy files from Linux client to `Windows





              1. There are multiple clients for running SSH servers on Windows such as
                OpenSSH from MS



                MobaSSH



                Bitvise SSH server




              2. Install one of the above servers and make sure that port 22 is open using





                netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=UDP localport=22



                netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=UDP localport=22





                netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=TCP localport=22



                netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=TCP localport=22





                netsh advfirewall set allprofiles state off




              3. Comparisons of these servers:



                Bitvise SSH server




                1. Provides almost close to native cmd prompt, powershell prompt,
                  autocompletion


                2. Provides additional capabilities for customization, if you need
                  advanced usage


                3. User customization for simple needs is 0. I got started on it within
                  2 mins, after having spent a lot of time trying to get MobaSSH and
                  OpenSSH to work.


                4. To copy files using scp use:
                  scp ~/filename.md username@10.33.44.45:/C/Users/username/filename.md


                5. Free for personal use, $99 for professional use. Because of so many
                  features and great integration, the price is well worth the money



                MobaSSH:




                1. provides a linux shell on windows where simple linux commands such
                  as ls, cp, find etc work, similar to MINGW64


                2. you can access cmd and powershell directly by typing cmd or
                  powershell


                3. Unicode support is poor. Encoding is not correct. For example if you
                  try to start Python interpretor, it will crash. You will need to
                  change the encoding manually using
                  (https://stackoverflow.com/a/12834315/4752883):
                  chcp 65001
                  set PYTHONIOENCONDING=utf-8
                  and then startup Python prompt


                4. The great thing about MobaSSH is that it has a very simple
                  user-interface, and scp and ssh and integrated well. So will
                  work for simple use cases


                5. To copy files from a Linux client to a Windows server running
                  MobaSSH: use
                  scp ~/filename.md
                  username@10.33.44.45:/cygdrive/c/Users/username/filename.md

                  This is because MobaSSH is based on cygwin and its drives are
                  mapped to the same way cygwin-s drives are mapped.



                Use VMs from Microsoft with OpenSSHv6.7 installed from
                https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/,
                OpenSSHv6.7 is already installed.




                1. Its very buggy, and you will need to heavily customize it.


                2. Command completion doesnt work


                3. It will leave blank spaces when you are moving cursor on the terminal


                4. Python doesn't work


                5. Later versions of OpenSSH, may have improved on it. Further MS seems to
                  make OpenSSH available via Optional Features
                  https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/









              share|improve this answer












              Solution to copy files from Linux client to Linux Server




              1. Check if sshd is running on your server using:
                ps aux | grep sshd


              2. If not install OpenSSH using
                sudo apt-get install openssh-server openssh-client
                https://www.tecmint.com/install-openssh-server-in-linux/


              3. Restart your server and verify that sshd is running using
                ps aux | grep sshd


              4. If you need you can configure your /etc/ssh/sshd_config file, but its not
                necessary for simple configurations


              5. verify that the ports are open using netcat
                nc -v -z 127.0.0.1 22


              6. To copy files from a Linux client to a Linux client use scp as follows
                scp ~/filename.md username@10.22.33.45:~/folder/filename.md


              7. To verify that file has been copied use
                ssh username@10.22.33.45 and provide your password.



              Solution to copy files from Linux client to `Windows





              1. There are multiple clients for running SSH servers on Windows such as
                OpenSSH from MS



                MobaSSH



                Bitvise SSH server




              2. Install one of the above servers and make sure that port 22 is open using





                netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=UDP localport=22



                netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=UDP localport=22





                netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=TCP localport=22



                netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=TCP localport=22





                netsh advfirewall set allprofiles state off




              3. Comparisons of these servers:



                Bitvise SSH server




                1. Provides almost close to native cmd prompt, powershell prompt,
                  autocompletion


                2. Provides additional capabilities for customization, if you need
                  advanced usage


                3. User customization for simple needs is 0. I got started on it within
                  2 mins, after having spent a lot of time trying to get MobaSSH and
                  OpenSSH to work.


                4. To copy files using scp use:
                  scp ~/filename.md username@10.33.44.45:/C/Users/username/filename.md


                5. Free for personal use, $99 for professional use. Because of so many
                  features and great integration, the price is well worth the money



                MobaSSH:




                1. provides a linux shell on windows where simple linux commands such
                  as ls, cp, find etc work, similar to MINGW64


                2. you can access cmd and powershell directly by typing cmd or
                  powershell


                3. Unicode support is poor. Encoding is not correct. For example if you
                  try to start Python interpretor, it will crash. You will need to
                  change the encoding manually using
                  (https://stackoverflow.com/a/12834315/4752883):
                  chcp 65001
                  set PYTHONIOENCONDING=utf-8
                  and then startup Python prompt


                4. The great thing about MobaSSH is that it has a very simple
                  user-interface, and scp and ssh and integrated well. So will
                  work for simple use cases


                5. To copy files from a Linux client to a Windows server running
                  MobaSSH: use
                  scp ~/filename.md
                  username@10.33.44.45:/cygdrive/c/Users/username/filename.md

                  This is because MobaSSH is based on cygwin and its drives are
                  mapped to the same way cygwin-s drives are mapped.



                Use VMs from Microsoft with OpenSSHv6.7 installed from
                https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/,
                OpenSSHv6.7 is already installed.




                1. Its very buggy, and you will need to heavily customize it.


                2. Command completion doesnt work


                3. It will leave blank spaces when you are moving cursor on the terminal


                4. Python doesn't work


                5. Later versions of OpenSSH, may have improved on it. Further MS seems to
                  make OpenSSH available via Optional Features
                  https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/










              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 12 at 1:04









              alpha_989

              1735




              1735






















                  up vote
                  0
                  down vote













                  Just a small contribution, maybe it can help beginners like me: the path to the the remote directory should be written like this: username@domain:~/remote_directory



                  What I want to highlight here is that we should always add that :~/






                  share|improve this answer

























                    up vote
                    0
                    down vote













                    Just a small contribution, maybe it can help beginners like me: the path to the the remote directory should be written like this: username@domain:~/remote_directory



                    What I want to highlight here is that we should always add that :~/






                    share|improve this answer























                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      Just a small contribution, maybe it can help beginners like me: the path to the the remote directory should be written like this: username@domain:~/remote_directory



                      What I want to highlight here is that we should always add that :~/






                      share|improve this answer












                      Just a small contribution, maybe it can help beginners like me: the path to the the remote directory should be written like this: username@domain:~/remote_directory



                      What I want to highlight here is that we should always add that :~/







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 29 at 15:52









                      Billal Begueradj

                      2271411




                      2271411






















                          up vote
                          -1
                          down vote













                          If you happen to be on OSX...



                          When I tried running it with username@local:/file_directory...



                          I got the following error:



                          ssh: local: node name or service name not known


                          Solution



                          On my Mac I had to do the following to setup local ssh:




                          ‘System Preferences’ --> ‘Internet & Networking’ --> ‘Sharing’ --> ENABLE ‘Remote Login’




                          This then provided the username@ip address.






                          share|improve this answer



























                            up vote
                            -1
                            down vote













                            If you happen to be on OSX...



                            When I tried running it with username@local:/file_directory...



                            I got the following error:



                            ssh: local: node name or service name not known


                            Solution



                            On my Mac I had to do the following to setup local ssh:




                            ‘System Preferences’ --> ‘Internet & Networking’ --> ‘Sharing’ --> ENABLE ‘Remote Login’




                            This then provided the username@ip address.






                            share|improve this answer

























                              up vote
                              -1
                              down vote










                              up vote
                              -1
                              down vote









                              If you happen to be on OSX...



                              When I tried running it with username@local:/file_directory...



                              I got the following error:



                              ssh: local: node name or service name not known


                              Solution



                              On my Mac I had to do the following to setup local ssh:




                              ‘System Preferences’ --> ‘Internet & Networking’ --> ‘Sharing’ --> ENABLE ‘Remote Login’




                              This then provided the username@ip address.






                              share|improve this answer














                              If you happen to be on OSX...



                              When I tried running it with username@local:/file_directory...



                              I got the following error:



                              ssh: local: node name or service name not known


                              Solution



                              On my Mac I had to do the following to setup local ssh:




                              ‘System Preferences’ --> ‘Internet & Networking’ --> ‘Sharing’ --> ENABLE ‘Remote Login’




                              This then provided the username@ip address.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jan 27 '15 at 19:31









                              slm

                              245k66505671




                              245k66505671










                              answered Jan 27 '15 at 18:42









                              Tim Maguire

                              11




                              11






















                                  up vote
                                  -1
                                  down vote













                                  I had this same problem today on MAC.



                                  Type the following command:



                                  scp /local-file-path/ /-remote-location-path/





                                  share|improve this answer



























                                    up vote
                                    -1
                                    down vote













                                    I had this same problem today on MAC.



                                    Type the following command:



                                    scp /local-file-path/ /-remote-location-path/





                                    share|improve this answer

























                                      up vote
                                      -1
                                      down vote










                                      up vote
                                      -1
                                      down vote









                                      I had this same problem today on MAC.



                                      Type the following command:



                                      scp /local-file-path/ /-remote-location-path/





                                      share|improve this answer














                                      I had this same problem today on MAC.



                                      Type the following command:



                                      scp /local-file-path/ /-remote-location-path/






                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Apr 13 at 9:09









                                      Kevdog777

                                      2,087123259




                                      2,087123259










                                      answered Apr 13 at 7:58









                                      heiwa

                                      1




                                      1






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Unix & Linux 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%2funix.stackexchange.com%2fquestions%2f115560%2fuse-scp-to-transfer-a-file-from-local-directory-x-to-remote-directory-y%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

                                          List directoties down one level, excluding some named directories and files

                                          list processes belonging to a network namespace

                                          list systemd RuntimeDirectory mounts