Windows to Linux (Rsync and SSH) - linux

I'm new to rsync, so my problem is probably obvious.
I'm trying to backup the folders in Windows Pictures to a remote Linux directory.
This is what I have:
rsync -av ssh /cygdrive/c/users/Owner/Pictures blah#192.168.1.10:/var/files/ImageSync
I got this format from: Transferring from Windows to Linux with rsync
But I am getting this error:
rsync: link_stat "/home/Owner/ssh" failed: No such file or directory (2)
rsync: change_dir "/cygdrive/c/users/Owner/Pictures" failed: No such file or directory (2)
sent 20 bytes received 12 bytes 64.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.1]
I have an ssh key pair already linked up, so there is no need for a password... Unless I did something wrong and that's why I am having issues.
Thanks!
Note:
Had to manually open cygdrive through cd and ls. It works!
rsync -av -e ssh /cygdrive/c/Users/Owner/Pictures/ blahc#192.168.1.10:/var/files/ImageSync/

I think you may need a "-e" ahead of ssh:
rsync -av -e ssh /cygdrive/c/users/Owner/Pictures blah#192.168.1.10:/var/files/ImageSync

Related

Vagrant rsync error: Error: Could not create directory '/home/Eric/.ssh'

I installer Vagrant 1.8.1 on Windows 10 and as well cygwin and cwRsync. Now i get this error when do vagrant up:
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.
Host path: /cygdrive/m/development/Projects/www.webapp.local/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o ControlMaster=auto -o ControlPath=C:/Users/Eric/AppData/Local/Temp/ssh.202 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'M:/development/Projects/www.webapp.local/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ /cygdrive/m/development/Projects/www.webapp.local/ vagrant#127.0.0.1:/vagrant
Error: Could not create directory '/home/Eric/.ssh'.
Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
Failed to connect to new control master
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.2]
I already tried the suggestions in this post: http://ekawas.blogspot.co.uk/2007/03/solving-pesky-ssh-issues-in-cygwin.html
But no success.
For now I tried to use another Debian 8 box and it suprised me that this box works in one time without the need to install rsync and cygwin seperate, like the way how Vagrant has to work in my opinion: install and setup without hassle. Also syncing the /vagrant folder works in both directions.
I really don't understand why some boxes need the hassle with installing rsync and cygwin and doing hacks in Vagrant files and other boxes just work with the basic setup of Vagrant.
Well I'm not a Vagrant expert, so maybe I miss something in this way? Maybe someone can explain?
This seems to be a known issue with Vagrant >=1.8.0 and Windows hosts.
For the ones still struggling, remove the following code in $VAGRANT_HOME\embedded\gems\gems\vagrant-1.8.0\plugins\synced_folders\rsync\helper.rb (lines 77 to 79):
"-o ControlMaster=auto " +
"-o ControlPath=#{controlpath} " +
"-o ControlPersist=10m " +
Source

rsync over ssh, gets permission denied

I gonna backup some files from a local machine to a remote server trough rsync over ssh. Here is the command I used:
rsync -avh -e "ssh -p 3286" somelocal_folder/ me#x.x.x.x:/data/bu/
The user(me) which I use to ssh to the server has rwx permissions on /data/bu directory but it does not have write permission on /data. It raises permission denied error when I enter my password. I searched a lot in the Internet,but I could not find any thing relevant. Any idea of the cause of the problem?!!

Rsync to Amazon Linux EC2 instance - failed: No such file or directory

I want to upload the content of one directory to my Amazon EC2 with rsync:
rsync -r -t -v --progress -z -s -e "ssh -i /home/mostafa/keyamazon.pem" /home/mostafa/splitfiles ubuntu#ec2-64-274-161-87.compute-1.amazonaws.com:~/splitfiles
but I receive the following error message:
sending incremental file list
rsync: link_stat "/home/mostafa/splitfiles" failed: No such file or directory (2)
rsync: change_dir#3 "/home/ubuntu//~" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(712) [Receiver=3.1.0]
and if I do a dry run with grsync, it works correctly
In rsync the trailing / is very important. Also you rsync usually defaults to ssh when one of the destinations contains a host.
So you if you want to preserver modification times then you can get rid of the -e and -s options.
Your command could be written as /home/mostafa/splitfiles/ ubuntu#ec2-64-274-161-87.compute-1.amazonaws.com:splitfiles/ - notice the trailing /'s provided that you have ssh configured to read the private key from your home directory.
On ubuntu you can add this to the key chain, by going
ssh-add [key-file]
And this will save you having to specify the keyfile everytime you ssh into the AWS machine.
The errors seem to say that on the local machine you don't have a source directory and the destination doesn't exist.
I completed this task with Filezilla instead, easier to use.
You are at home ~ if you cd ../ to root you will be able to run the command.

rsync ssh recursive dry run error / no rsync on server

looking to use rsync to transfer directory from remote to local recursivly with a dry-run.
So far from rync man pages I settle on this:
rsync -rnvh user#server.com:/directory /local_directory/
and I get this
rsync error: remote command not found (code 127)
do I have to use this:
scp -rv user#server.com:/directory /local_directory/
(Which works perfectly fine for my one-time limited case) I'd rather get rsync running.
I've tried installing rsync on server without success. My access is quite limited on the remote server.
You don't need the -e ssh (unless you're using a really really ancient version of rsync) - ssh is the default.
For dry run:
rsync -avn user#server.com:/directory/ /local_directory/
For actual sync:
rsync -av user#server.com:/directory/ /local_directory/
Also note the trailing /s - otherwise you can end up with /local_directory/local_directory etc.

Impossible to use rsync with Cygwin

Hi I have installe cygwin and I would like to use rsync but I have this error
Bad owner or permissions on /home/LUPI/.ssh/config
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [sender=3.0.9]
I have create the key with this command line and the key
ssh-keygen -t rsa -f ~/.ssh/id_rsa -C "userName"
and the key are similar in the server and in my computer. How to resolve this?
This question should be on superuser or serverfault, and secondly this is an ssh permissions issue and NOT a rsync issue, but here is the solution:
chown -R $USER:users ~/.ssh/
chmod -R 600 ~/.ssh/

Resources