Celeb Glow
updates | March 14, 2026

How to copy a file without using scp inside an ssh session?

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.

5

5 Answers

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
10

Try this:

cat myfile.txt | ssh me@otherhost 'cat - > myfile.txt' 
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 "
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
"
1

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

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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