my $ctl_path = '/home/user/.myapp/ssh_ctl_path'; unlink $ctl_path; # just in case it has been left behind in a previous run of the script. my $ssh = Net::OpenSSH->new(... ctl_path => $ctl_path); $ssh->die_on_error; system('sudo', 'rsync','-e',"ssh -S $ctl_path",'--blocking-io','-q','--','host:/remote/directory','/local/directory') and die "rsync command failed: $?"; #### rsync -e ssh -S /home/user/.myapp/ssh_ctl_path --blocking-io -q -- host:/remote/directory /local/directory