Is there a way to retrieve a secure copy in UNIX?

Why would I need to do this? Because I can login to a remote machine from my local machine, but not the other way around. So I need to retrieve a secure copy instead of just using scp to send a file from my remote machine to my local machine.

  • 4
    What's the difference between "retrieve a secure copy" and "use scp to send a file from remote to local"? Why is the latter not sufficient? – glenn jackman Jul 21 '14 at 13:15

scp can be used both to copy to a remote machine, and from one:

I assume you are used to using:

scp localfile USER@REMOTE:remotefile

But you can also use it to do:

scp USER@REMOTE:remotefile localfile
| improve this answer | |
  • Worked!! Is there a way to get this to append to that local file, however? – MrPickles Jul 21 '14 at 13:27
  • To my knowledge, not without going via a temporary file – Andrew Stubbs Jul 21 '14 at 13:29

To append a remote file to a local one, improving Andrewe Stubbs answer copy to local stdout and append that:

 scp USER@REMOTE:remotefile /dev/stdout >> localeppendedfile

or simply (assuming a Posix remote machine)

 ssh USER@REMOTE /bin/cat removefile >> localeppendedfile
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.