0
I'm wondering if there's any way, while in an established ssh session, to copy files to and from the source computer, without having to use sftp or scp to create a separate connection, requiring more authentication. I'm looking for either something short and quick to type, or something verbose that I can write a quick-to-type alias or function for.
Here's an example of what an ideal-ish (for me) situation would look like:
$ ssh me@otherhost
password:
$ cpback somefile.txt ~/Documents
copying 'otherhost:~/somefile.txt' to 'localhost:~/Documents/somefile.txt'
$ cpfore otherfile.py ~/Downloads
copying 'localhost:~/otherfile.py' to 'otherhost:~/Downloads/otherfile.py'
In this example, cpback
would be to copy from the remote host, and cpfore
would copy files from the local host.
i think scp is your best choice, its the simplest by far – TheStarvingGeek – 2016-05-12T12:01:41.750
It's not impossible in theory, but... You establish your ssh session with ssh to set up your terminal, your shell, your environment, to interact and run commands. If you want it to have a transmission feature while in this session, you will have to either code that feature yourself in your own ssh client or use the ~C escape sequence, redirect ports and send data through them and catch it on the other side... that is you must write your own scp inside ssh. I doubt it's worth it. – Gombai Sándor – 2016-05-12T12:30:38.077
Possible duplicate of Execute multiple commands over ssh without reconnecting -- not complete duplicate, but it might help you
– Jakuje – 2016-05-12T15:38:57.273@Jakuje thanks, that gave at least a workable solution. I can probably use it to make a bunch of alias functions – Zoey Hewll – 2016-05-13T03:25:34.440