Re:Termbin: Easiest way to copy over SSH
by jonathonf on Tuesday January 31, 2017 @05:48AM
(#13529440)
What's the best way of scp'ing from a remote server connection to local machine, if the local machine isn't externally accessible (e.g. isn't running SSH)?
e.g.
local$ ssh remote
remote$ # do some stuff
remote$ echo "Text" > file.txt
remote$ # oh, I need to copy file.txt back to my local host
remote$ #?> What's the best way of scp'ing from a remote server connection to local machine, if the local machine isn't externally accessible (e.g. isn't running SSH)?
If by "not externally accessible" you mean the local machine is not running an SSH server, but has an SSH client available and the machine is connected to the network, and the remote machine is running an SSH server, then:
$ scp remoteuser@remotehost:remotepath/remotefile localfile
Re:Termbin: Easiest way to copy over SSH
by throwaway2016a on Tuesday January 31, 2017 @09:24AM
(#13530732)
If you can't do what another poster suggested and do the transfer the other way around... uploading the file to AWS S3 from the CLI works pretty well. Though unlike the solution in this post does require installing heavier software.
Also, alternatively... pipe it to `mail` and send it over email.
I would use
local$ scp user@remote:/path/to/file.txt local_file.txt
If your local machine is not externally accessible, you have to initiate the access on it.
$ scp (source path) (destination URI):(destination path)
For a stream between systems instead of a file, do it this way:
$ cat localfile | ssh user@host "cat > remotefile"
-- or --
$ ssh user@host "cat > remotefile" < localfile