multihop scp and ssh for QRIScloud servers
Introduction
Due to firewall and subnet ACL implementation within the institution, you will often find that most computers do not have direct access to QCloud servers.
Let's say you want to copy a file from machine A to server C (QCloud Server), but only have access to server C through server B.
Instead of first transferring to server B, log in and then transfer to server C (e.g QCloud Server), we can transfer the file(s) directly with multi-hop SCP to server C from Server A. Similarly , it is possible to login directly through multi-hop ssh to ServerC (qcloud server) from Server A.
The multi-hop scp syntax is:
From Machine A: scp -o ProxyCommand="ssh $serverB nc $ServerC 22" $local_path user@$ServerC:$destination_path
Similarly multi-hop ssh syntax is:
From Machine A: ssh -t user@machineB "ssh -t user@machineC
Examples
Multi-hop scp
From Machine A: scp -rCp -o "ProxyCommand ssh s123456@gowonda2.rcs.griffith.edu.au nc -v photo.qcloud.qcif.edu.au 22" /tmp/testdir user@photo.qcloud.qcif.edu.au:/data/Q1256
Multihop ssh
From Machine A: ssh -t s123456@gowonda2.rcs.griffith.edu.au "ssh -t user@alphoto.qcloud.qcif.edu.au"
This works wonderfully with ssh keys if needed.
Reference
1. http://chrislaing.wordpress.com/2011/06/16/two-hop-scp/
2. http://serverfault.com/questions/37629/how-do-i-do-multihop-scp-transfers