2014-05-07 63 views
3

我想rsync從Windows到Linux的目錄。從Windows到Linux的Rsync,使用putty的pagent認證

的Linux:

沒有rsyncd的運行,rsync的命令行應在Linux上調用。

的Windows:

我在pagent.exe 簡單的批處理文件加載的SSH密鑰想無需安裝的程序。 cygwin的rsync.exe不支持putty/pagent。

由於文件數量巨大,Robocopy並不好。 我怎樣才能從一個簡單的批處理文件從Windows到Linux的rsync

回答

2

你不需要安裝完整的cygwin,這個批處理文件中顯示的小目錄結構就足夠了。還有就是要「嫁」 Cygwin和膩子,世界需要一個小幫手:cygnative.exe

所有你需要在這個批處理文件中描述:

rem This is file: rsync_some_winfiles_to_linux_with_pagent.bat 

rem This is what I want: 
rem 
rem Windows with Putty+Pagent -> rsync -> Linux 
rem 
rem pagent.exe is already loaded with my ssh-key 
rem This ssh-key shall make the authentication to the remote rsyncd/Linux 
rem 
rem Environment for this Batch-file: 
rem 
rem plink.exe for Windows, derived from cygwin 
rem download here: 
rem http://it-em.net/joomla/downloads/rsync.zip 
rem with german dokumentation in http://it-em.net/joomla/index.php?option=com_content&view=article&id=49&Itemid=54cms/front_content.php 
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  http://diario.beerensalat.info/2009/08/18/new_cygnative_version_1_2_for_rsync_plink.html 
rem 
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 + some-files-dir/   # Here are the file which shall be transferred 
rem  + bla.txt 
rem  + foo.txt 
rem 
rem our current working is the same where this bat-file is 

set SRC_DIR=./some_files_dir/ 
set DST_USER=www-data 
set DST_SERVER=your-destination-server-with-ssh.example.com 
set DST_PORT=23765 
set DST_DIR=/var/www/...what-you-like/some_files_dir 

bin\rsync.exe -v -d --delete -e="./bin/cygnative.exe ./bin/plink.exe -P %DST_PORT%" %SRC_DIR% %DST_USER%@%DST_SERVER%:%DST_DIR% 
+0

爲'cygnative.exe'鏈接是死。以下是我設法找到的幾個備選方案:[this gist](https://gist.github.com/silviuvulcan/7609c438f6ab5e51c8d19890e949565f)和[此zip](http://franklinstrube.com/wp-content/uploads /2013/03/cygnative1.2.zip)。我已經使用了zip中包含的可執行文件,但是我無法爲任何源文件擔保。原作者似乎已將他的博客取消,但他的網站是[這裏](http://frank-behrens.de)。 – starfry