Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use rsync to sync files between a local directory and a remote host. I also use plink to automate my SSH passphase entry.

What I can't figure out is how to use rsync with plink. This is what I think the syntax should be:

rsync -args --rsh="plink user@remote" local_dir/ :/remote_dir

But I get "Access Denied" messages. Is there a way to do this? Is it simple?

Edited to reflect what I think the syntax should look like. I had it very wrong before.

share|improve this question

This is a complete Batch-file to solve the problem:

rem This is file: copy_win_inifiles_to_linux_via_rsync_with_pagent.bat

rem This is what I want:
rem Windows with Putty+Pagent -> rsync -> Linux
rem pagent.exe is already loaded with my ssh-key
rem This ssh-key shall make the authentication to the remote rsyncd/Linux
rem Environment for this Batch-file:
rem plink.exe for Windows, derived from cygwin
rem download here:
rem    with german dokumentation in
rem cygnative.exe is needed from plink.exe (putty-suite) 
rem so that plink.exe works together wird rsync.exe
rem download cygnative here:
rem Filetree looks like this:
rem + copy_win_inifiles_to_linux_via_rsync_with_pagent.bat
rem + bin/
rem      + rsync.exe
rem      + cygwin1.dll         # needed from rsync.exe
rem      + cygiconv-2.dll      # needed from rsync.exe
rem      + cyggcc_s-1.dll      # needed from rsync.exe
rem      + cygnative.exe       # standalone-program
rem      + plink.exe           # from putty-suite, standalone-program
rem + ini/                     # Here are the file which shall be transferred
rem      + bla.ini
rem      + foo.ini
rem our current working is the same where this bat-file is

set SRC_DIR=./ini/
set DST_USER=yourusername
set DST_PORT=22
set DST_DIR=/home/yourusername/what/ever/ini

bin\rsync.exe -v -d --delete -e="./bin/cygnative.exe ./bin/plink.exe -P %DST_PORT%" %SRC_DIR% %DST_USER%@%DST_SERVER%:%DST_DIR%
share|improve this answer

It seems to be an incompatibility in stdin/stdout redirection between cygwin and native Win32 programs.

Someone has managed to make a wrapper that solves the problem:

The usage would be something like:

rsync -args -e="cygnative plink" local_dir/ user@remote:/remote_dir
share|improve this answer

I typically do my rsyncs over ssh with something similar to the following:

rsync -args -e "ssh -i .ssh/my-key" user@hostname:/dir1 /dir2

You could try substituting the appropriate plink or putty command.

share|improve this answer
Thank you, but it's not working for me. Please see my edits because I originally messed up the syntax of the rsync command. – Corey May 2 '11 at 14:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.