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.
55 Answers
To send a file:
cat file | ssh ajw@dogmatix "cat > remote"Or:
ssh ajw@dogmatix "cat > remote" < fileTo 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.
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.