3 ms·
In my experience, the easiest way to copy over SSH is with scp: $ scp (source path) (destination URI):(destination path) For a stream between systems instead
by lutusp 10y ago
In my experience, the easiest way to copy over SSH is with scp:
$ 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
- jonathonf 10y agoWhat'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$ #?
- 013 10y agolocal$ scp remote:~/file.txt ./
- yorwba 10y agoI 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.
- throwaway2016a 10y agoIf 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.
- lutusp 10y ago> 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