In general, we can easily sync a remote directory using rsync.
Bash
$ rsync -avzh --progress --delete \
name@remote_host:source_dir target_dirThis pulls a remote directory down to the local machine.
But here comes the question: when the port is not the standard 22, how should we pass the parameter? For example, sometimes we NAT to port 2222.
The answer is simple:
Bash
$ rsync -avzh --progress --delete -e "ssh -p 2222" \
name@remote_host:source_dir target_dirOf course, rsync has many other powerful features; check the rsync man page for more.
Reference: Rsync with a non-standard ssh port
Comments
No comments yet — be the first to write one.