How to rsync remotely to the cluster

From DISI
Revision as of 20:12, 17 March 2014 by Frodo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Here are scripts that allow you to copy files from outside the network to inside the network in one step. Thanks to Matt!

Make two script on the PATH, (I've done it to primus, but you can chose the destination)

open_primus

#!/bin/bash                                                                                                                                     
LOCAL_PORT=5000
GATEWAY_HOST={portal machine}
GATEWAY_PORT=22
REMOTE_HOST=primus.fully.qualified.name
REMOTE_PORT=22
SSH_CTRL_PATH=~/.ssh-tunnel-${GATEWAY_HOST}
ssh -p 22 -L ${LOCAL_PORT}:${REMOTE_HOST}:${REMOTE_PORT} ${GATEWAY_HOST}  -N -f -M -S ${SSH_CTRL_PATH}

and close_primus

#!/bin/bash                                                                                                                                     
LOCAL_PORT=5000
GATEWAY_HOST={portal machine}
GATEWAY_PORT=22
REMOTE_HOST=primus.fully.qualified.name
REMOTE_PORT=22
SSH_CTRL_PATH=~/.ssh-tunnel-${GATEWAY_HOST}
ssh -S ${SSH_CTRL_PATH} -O exit ${GATEWAY_HOST}

Then to use it,

open_primus

localhost with port 5000 effectively is primus, eg

rsync -Phavz 'ssh -p5000' /tmp/abc.txt localhost:/tmp/

will copy a file form the current computer to primus

close_primus

For security, contact sysadmins for small but important additional information.