You can use scp
to copy single or multiple files and also use rsync
with an ssh transport:
scp -r localdirectoryname username@hostname:/remotepath
and
rsync -av localdirectory username@hostname:/remotepath
Both programs also work the other way round, with the remote part as the origin and the local as the destination.
See man scp
and man rsync
.
Edit
If you indeed need an intermediate server, you could use ssh port forwarding:
In one shell, use this command to establish a port forwarding:
ssh -NL 10022:10.199.199.91:22 [email protected]
This connects port 10022 on your local machine with port 22 on 10.199.199.91
, but won't open a shell, instead just blocks until you terminate it.
Afterwards, on another shell/xterm, you can use either
scp -r -P 10022 localpath soak@localhost:/remotepath
but have to be aware that soak@localhost
actually points to [email protected]
when entering your credentials.
Edit 2, now featuring rsync
As you specifically asked about rsync, here is how to use rsync instead of scp. It requires the same port forwarding enabled as the scp
variant:
rsync -av --rsh="ssh -p 10022" localpath soak@localhost:/remotepath
and again remember that you are actually connecting to [email protected]
.