2012-05-16

Scratch of the day - ssh transfer from server to server

There's 2 servers which configured only my workstation is able to login using ssh keys. But I need to transfer files between these 2 servers. Downloading from server A to my workstation then upload the files to server B seems to be way. It would be good if I can combine the 2 operations into 1 single execution.

With shell's pipe, cat & ssh, this is what I've come up with :
ssh bob@server-A.example.com "cat /source/file-or-directory.txt" | \
ssh bob@server-B.example.com "cat > /destination/file-or-directory.txt"

Shalom !!!

No comments: