Redirecting Linux IO with SSH
Redirecting STDOUT from LOCAL MACHINE to FILE in another MACHINE

Example use would just be to copy a file. Another would be to list the contents of ones filesystem tree with find command but save it into remote file else where.

SYNTAX
cat localfile | ssh remotehost [SSH OPTIONS] “cat – > remotesavelocation”
MY FAVORITE OPTIONS ARE FOR SPEED (fastest encryption and using compression as well) ALSO CAN CHANGE THE SSH PORT BECAUSE NOT ALL REMOTEHOSTS USE THE DEFAULT 22 PORT FOR SSH
cat localfile | ssh remotehost -c arcfour,blowfish-cbc -C -p 50115 “cat – > remotefile2sa”

EXAMPLES BELOW:

cat copy with ssh
cat mvr | ssh www.ko.com -c arcfour,blowfish-cbc -C -p 50115 “cat – > /tmp/mvr.txt”
cat filein | ssh www.ko.com -c arcfour,blowfish-cbc -C -p 50115 “cat – > /tmp/fileout”

We dont have to just use cat, we can copy output of commands like this as well
Copy Directory Structure from One Location to another
EXAMPLE:
find . -type f | ssh www.ko.com -c arcfour,blowfish-cbc -C -p 50115 “cat – > /tmp/step1a.txt”

Leave a Reply

Your email address will not be published. Required fields are marked *