In my .ssh/config file I have the following:Host xxxUser yyyHostName zzzzControlMaster autoControlPath ~/.ssh/%r@%h:%p This works great for multiplexing my ssh connections (i.e. login once, and share the connection with multiple sessions).I would like to multiplex (share) my ssh connection with rsync, so that I can do things like rsync -arv -e ssh xxx:/source targetand not have to login through rsync (I have two-factor authentication system with XXX and it would be great if I can just skip that when I use rsync).Update: I learn that by default rsync would try to re-use the connection first. So I am not sure why it isn't working. Here is the verbose output of my attempt:> rsync -arv -e 'ssh -v' XXX:~/file ~/temp/.OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008debug1: Reading configuration data /home/YYYY/.ssh/configdebug1: Applying options for XXXdebug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: auto-mux: Trying existing masterControl socket connect(/home/YYY/.ssh/XXX@ZZZZ:22): Connection refused
Can't share an ssh connection with rsync
ssh;rsync
I just tried this exact thing and it worked for me. NOTE: I should also include that prior to running the commands below I ran this command, which sets up the user account on the remote host for use with my local user account's ssh credentials.ssh-copy-id root@skinnerMy setup is as follows:$HOME/.ssh/config:Host *ControlMaster autoControlPath ~/.ssh/master-%r@%h:%pIdentityFile ~/.ssh/id_dsaHost skinner mulder byers    User rootcontents of $HOME/.ssh/:$ ls -dl ~/.sshdrwx------ 2 saml saml 4096 May 23 03:18 /home/saml/.ssh$ ls -l ~/.sshtotal 16-rw------- 1 saml saml 204 May 23 03:17 config-rw------- 1 saml saml 736 Jan 10  2011 id_dsa-rw-r--r-- 1 saml saml 612 Jan 10  2011 id_dsa.pub-rw-r--r-- 1 saml saml 401 May 23 03:17 known_hostsNow ssh to host skinner:   contents of $HOME/.ssh/:$ ls -l ~/.sshtotal 16-rw------- 1 saml saml 204 May 23 03:17 config-rw------- 1 saml saml 736 Jan 10  2011 id_dsa-rw-r--r-- 1 saml saml 612 Jan 10  2011 id_dsa.pub-rw-r--r-- 1 saml saml 401 May 23 03:17 known_hostssrw------- 1 saml saml   0 May 23 03:25 master-root@skinner:22send somefile.txt to remote host:$ rsync -arv -e ssh somefile.txt skinner:~sending incremental file listsomefile.txtsent 106 bytes  received 31 bytes  91.33 bytes/sectotal size is 13  speedup is 0.09pull somefile.txt from remote host:$ rsync -arv -e ssh skinner:~/somefile.txt somefile-remote.txtreceiving incremental file listsomefile.txtsent 30 bytes  received 100 bytes  260.00 bytes/sectotal size is 13  speedup is 0.10results of above rsync commands:$ ls -ltotal 8-rw-rw-r-- 1 saml saml 13 May 23 03:19 somefile-remote.txt-rw-rw-r-- 1 saml saml 13 May 23 03:19 somefile.txtsend somefile.txt to remote host (-v):$ rsync -arv -e 'ssh -v' somefile.txt skinner:~OpenSSH_5.5p1, OpenSSL 1.0.0e-fips 6 Sep 2011debug1: Reading configuration data /home/saml/.ssh/configdebug1: Applying options for *debug1: Applying options for skinnerdebug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: auto-mux: Trying existing masterdebug1: mux_client_request_session: master session id: 5sending incremental file listsomefile.txtdebug1: mux_client_request_session: master session id: 5sent 106 bytes  received 31 bytes  274.00 bytes/sectotal size is 13  speedup is 0.09send somefile.txt to remote host (-vv):$ rsync -arv -e 'ssh -vv' somefile.txt skinner:~OpenSSH_5.5p1, OpenSSL 1.0.0e-fips 6 Sep 2011debug1: Reading configuration data /home/saml/.ssh/configdebug1: Applying options for *debug1: Applying options for skinnerdebug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: auto-mux: Trying existing masterdebug2: fd 3 setting O_NONBLOCKdebug2: mux_client_hello_exchange: master version 4debug1: mux_client_request_session: master session id: 5sending incremental file listsomefile.txtdebug1: mux_client_request_session: master session id: 5debug2: Received exit status from master 0sent 106 bytes  received 31 bytes  274.00 bytes/sectotal size is 13  speedup is 0.09