92

I have logged on to a system with ssh and there is no scp present on both the systems. How to copy a file without using the scp program.

Talespin_Kit
  • 3,581

5 Answers5

152

To send a file:

cat file | ssh ajw@dogmatix "cat > remote"

Or:

ssh ajw@dogmatix "cat > remote" < file

To receive a file:

ssh ajw@dogmatix "cat remote" > copy
8

Try this:

cat myfile.txt | ssh me@otherhost 'cat - > myfile.txt' 
Keith
  • 8,293
3

You can use xxd and some ugly quoting to copy over multiple files as well as run commands on them and execute them:

ssh -t foo@bar.com "
echo $'"$(cat somefile | xxd -ps)"' | xxd -ps -r > "'somefile'"
chmod +x somefile
echo $'"$(cat someotherfile | xxd -ps)"' | xxd -ps -r > "'someotherfile'"
chmod +x someotherfile
./somefile
./someotherfile
"
Aric
  • 31
-1

python3 -m http.server in the same directory with desired file - after that you can curl or wget or download a file with your browser. Note that with that running command all your files from current directory will be publicly available, until you press Ctrl+C.

Vitaly Zdanevich
  • 211
  • 1
  • 4
  • 19
-2

Besides piping the file to a remote cat, you may also be able to use some SFTP client to transfer the files.

salva
  • 179