Rsync over SSH with a custom port



Published: 2018-12-21 13:51:22 +0000
Categories: BASH,

Language

BASH

Description

It's not at all uncommon nowadays for SSH not to be listening on TCP 22, but to instead be bound to another port - primarily to prevent brute force attacks by the various dumbest-of-the-dumb bots out there

Occasionally, though, you then want to use rsync over an SSH tunnel, and need to specify the port to use so that rsync uses the custom SSH port instead of port 22

It's pretty straightforward, but is one of those things I use infrequently enough to need to look it up from time to time

Snippet

rsync -avz -e "ssh -p [port number]" /local/path [user]@[remotehost]:/path/to/dest/dir/

Usage Example

rsync -uavz -e "ssh -p 8822" /mnt/imagestore foo@images.example.com:/var/www/html/images/

Keywords

rsync, ssh, custom port,

Latest Posts


Copyright © 2022 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk, http://phecoopwm6x7azx26ctuqcp6673bbqkrqfeoiz2wwk36sady5tqbdpqd.onion and http://snippets.bentasker.i2p
hit counter