Transferring from Windows to Linux with rsync

匆匆过客 提交于 2019-12-04 13:22:15

问题


noob here,

I'm trying to transfer a file using rsync from windows to linux. I have this code, but I'm getting an error

rsync -avz -e ssh C:\users\file.txt root@123.45.67.89:/var/dir

I get this error The source and destination cannot be both remote

And if I try

rsync -avz -e ssh /c/users/file.txt root@123.45.67.89:/var/dir

I get, No such file or directory

So, I think the problem is with the path of the file on the windows.. I've heard about cygwin but haven't really tried it

What can I do to get the path to work?


回答1:


If you're using CygWin to rsync from the Windows box, the local file you want is almost certainly:

/cygdrive/c/users/file.txt

rather then:

/c/users/file.txt



回答2:


Writing the right rsyncd.conf is a little bit complicated.

I get the error message

@ERROR: chdir failed rsync error: error starting client-server protocol (code 5) at main.c(1296) [receiver=2.6.8]

and

2012/06/10 14:59:43 [9252] rsync: chdir /cygdrive/d failed : No such file or directory (2)

Because I miss the "use chroot = false" directive in my rsyncd.conf

Here is an example of rsyncd.conf:

log file        = c:/rsync.log
auth users      = backup
secrets file    = /cygdrive/c/Program Files/RSync/rsyncd.secrets

[backup]
comment         = Backup this host
path            = /cygdrive/d
use chroot      = false
strict modes    = false
read only       = false
transfer logging = yes
hosts allow     = 192.168.2.252

Be sure the rsync.log file is created/changed after restart service, if it's not done, you have some error in your rsyncd.conf file and the rsync does'nt use them but no error or info is showed at all!

And so, the format of rsyncd.secrets file, is:

backup:<password>


来源:https://stackoverflow.com/questions/4182286/transferring-from-windows-to-linux-with-rsync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!