gpt4 book ai didi

linux - 从 Windows 到 Linux 的 Rsync,使用 putty pageant 身份验证

转载 作者:可可西里 更新时间:2023-11-01 09:29:00 24 4
gpt4 key购买 nike

我想将一个目录从 Windows 同步到 Linux。

Linux:

没有运行 rsyncd,在 Linux 上调用命令行 rsync。

Windows :

我在 pagent.exe 中加载了一个 ssh-key无需安装程序即可获得简单的批处理文件。cygwin 的 rsync.exe 不支持 putty/pagent。

Robocopy 不好,因为文件量很大。我怎样才能在一个简单的批处理文件中从 Windows rsync 到 Linux

最佳答案

您不需要安装完整的 cygwin,这个批处理文件中显示的一个小目录结构就足够了。 “嫁接”cygwin 和 putty-worlds 需要一个小 helper ,即: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%

关于linux - 从 Windows 到 Linux 的 Rsync,使用 putty pageant 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23517023/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com