Skip to content

Rsync plus ssh config

wordpress meta

title: 'Rsync Plus SSH Config'
date: '2018-05-22T15:34:03-05:00'
status: publish
permalink: /rsync-plus-ssh-config
author: admin
excerpt: ''
type: post
id: 1217
category:
    - rsync
    - SSH
tag: []
post_format: []

Sometimes you need to use settings from the ssh config file or in my case a custom config file. Here is a quick note on how I did it.

Example without SSH config just using the key and user@publicIP

$ pwd
/home/rrossouw/.ssh

$ rsync -avz --exclude "env-vars" -e "ssh -i /media/sf_DATA/ssh-keys/oci-mgmt" /media/sf_DATA/src/terraform/* opc@pu.blic.ip:~/terraform/
sending incremental file list
devtest/lb_private.tf

sent 2,650 bytes  received 91 bytes  1,096.40 bytes/sec
total size is 1,343,000  speedup is 489.97

Example with SSH config

$ pwd
/home/rrossouw/.ssh

$ rsync -avz --exclude "env-vars" -e "ssh -F My-config" /media/sf_DATA/src/terraform/* jump01:~/terraform/
sending incremental file list

sent 2,607 bytes  received 32 bytes  1,759.33 bytes/sec
total size is 1,343,000  speedup is 508.90