rsync from linux to windows without smb mount - cygwin

I would like to use rsync to mirror a git repo from a linux machine to several Windows servers. What I'm seeing online so far are solutions that require you mount the Windows side using samba. ideally I would like to avoid that because it would require managing several mounts, not to mention security concerns. I've verified that I can at least ssh onto my test server. I have cwRsync installed on the windows server. I try the following command, but rsync doesn't seem to like the space in the path to the rsync executable.
rsync -rlH --rsync-path="c:/Program\ Files/cwRsync/bin/rsync.exe" . Administrator#cool03-stage:d:/rsync_test/.
'c:/Program\' is not recognized as an internal or external command,
operable program or batch file.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]

After adding C:\Program Files\cwRsync\bin to my PATH on the Windows server, I can run this:
rsync -rlH -e ssh . Administrator#cool03-stage:/cygdrive/d/rsync_test/.
Seems to work.

Related

how can i debug these rsync errors

I've been trying to get rsync working to keep track of files from a web server (linux) to my windows desktop.
Both the server and my machine has rsync installed. I am trying to pull files from the server down to my local machine, just the ones that have changed or update since I pushed them to the server as it's a file based CMS running.
If I run: rsync -avn -e "ssh -p [port]" [user]#[ip]:~/public_html/ ./ - So I am hoping that this will copy files from the /public_html/ folder so the current directory I am running from the command from.
The errors I get are:
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.3]
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.2.7]
I've read that a server and localhost can have different versions and still run ok, and some people suggest directory issues but the directory exists. How can I debug this more?

Run rsync via cron on Mac OS Catalina

There are many posts about this on the web but I have not found a working solution for my issue.
I'm on Mac OS Catalina. I have written a script to rsync a remote directory, via ssh, to my local computer:
#!/bin/bash
/usr/bin/rsync -arvzhe --delete 'ssh -i /Users/myusername/.ssh/id_rsa' user#XX.XXX.XX.XX:/home/storage/app/public /Users/myusername/public/
But it fails with the error:
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54/rsync/io.c(453) [receiver=2.6.9]
The rsync call works fine when calling manually from the Terminal.
I do have a private key file in /Users/myusername/.ssh/id_rsa
Thanks.
You have to give your terminal app full disk access. (It will still have to obey Unix-level permissions after you do, but right now you are bumping into another layer of security that Mac OS has added.)
To fix, go to: System Preferences => Security and Privacy => Privacy, select "Full Disk Access" and check the "Terminal" box on the right.

Rsync without password file without ssh

I would like to establish rsync between Windows 7 and linux server for file transfer. I am trying to make this as simple as possible. As topic, is there any way to use rsync without password file and ssh? I was searching for few days but only found solution with either password-file or ssh.
I am using:
Client Env
Windows 7
cwRsync 5.5.0
Server Env
Linux Redhat 6.3 Santiago
rsync 3.1.1
If you want to use rsync without using SSH at all, then you can do it using an rsync server.
It requires installing rsyncd on the Linux server, and setting up and configuring an always-running service, but there's a tutorial here (from 1999!) that says how to do it.
You can set it up to allow access without a username and password, but only do that within a trusted network! Note that, even with a password, there won't be any encryption, so use with caution.
on the source system:
vim /etc/rsyncd.conf
then add your path
[your_path_name]
path = /any_directory/your_path_name
comment = My fast rsync server
read only = yes
list = yes
start the rsync server
sudo systemctl start rsync
and on the destination server:
rsync -r rsync://X.X.X.X:/your_path_name ./my_directory/ --progress

Mounting a folder from other machine in linux

I want to mount a folder which is on some other machine to my linux server. To do that i am using the following command
mount -t nfs 192.xxx.x.xx:/opt/oracle /
Which is executing with the following error
mount.nfs: access denied by server while mounting 192.xxx.x.xx:/opt/oracle
Do anyone knows what's going on ??? I am new to linux.
Depending on what distro you're using, you simply edit the /etc/exports file on the remote machine to export the directories you want, then start your NFS daemon.
Then on the local PC, you mount it using the following command:
mount -t nfs {remote_pc_address}:/remote/dir /some/local/dir
Please try with your home directory as per my knowledge you can't dump anything directly on root like that.
For more reference, find full configuration steps here.

rsync ssh fails to connect

When trying to connect via rsync to download a file using the following command:
rsync -Pav http://some.domainname.com/file.tar.gz
The following error is given to me
ssh: Could not resolve hostname http: Connection timed out
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9]
If i try and download the same file using the ftp commands instead it works fine. If i try and use the rsync command from a pc on another network instead this also works fine, so it seems to be something environmental.
The customers client pc sits behind a proxy server, but all the proxy address details have been added to the system, and i'm able to browse, ftp, and ssh onto a test server without any issues. Is there anything that may be blocking rsync from running?
You are mixing curl/wget and rsync.
wget http://some.domainname.com/file.tar.gz
or
rsync a_user#some.domainename.com:/path/to/webdir/file.tar.gz /local/dest/dir

Resources