I'm trying to rsync files between 64bit windows 7 and 64bit Linux. I have rsync 3.0.7 installed on both machine (cygwin version on windows).
This is the command I'm running on windows. I see it's establishing a connection to the remote machine but it just dies after authenticating and before transferring files. What could cause this problem?
rsync -vvvv localfile REMOTE-HOST:~/
FILE_STRUCT_LEN=16, EXTRA_LEN=4
cmd=<NULL> machine=REMOTE-HOST user=guest path=~/
cmd[0]=ssh cmd[1]=-l cmd[2]=guest cmd[3]=REMOTE-HOST cmd[4]=rsync cmd[5]=--server cmd[6]=-vvvvv.Lsf cmd[7]=. cmd[8]=~/
opening connection using: ssh -l guest REMOTE-HOST rsync --server -vvvve.Lsf. "~/"
note: iconv_open("UTF-8", "UTF-8") succeeded.
Password:
FILE_STRUCT_LEN=24, EXTRA_LEN=4
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
[Receiver] _exit_cleanup(code=12, file=io.c, line=601): entered
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [Receive
r=3.0.7]
[Receiver] _exit_cleanup(code=12, file=io.c, line=601): about to call exit(12)
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
[sender] _exit_cleanup(code=12, file=/home/lapo/packaging/rsync-3.0.7-1/src/rsyn
c-3.0.7/io.c, line=601): entered
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packagi
ng/rsync-3.0.7-1/src/rsync-3.0.7/io.c(601) [sender=3.0.7]
[sender] _exit_cleanup(code=12, file=/home/lapo/packaging/rsync-3.0.7-1/src/rsyn
c-3.0.7/io.c, line=601): about to call exit(12)
The problem was a conflicting git installation. Git included it's own ssh and it's path was before cygwin path, so rsync was using git's ssh. The fix was to swap the order of git/cygwin bin path so rsync was using the right version of ssh.
I found a way around this error by adding the absolute path to ssh in my call:
rsync -avzphi --chmod=ugo=rwX --checksum --delete-after -e
"C:\cwRsync\ssh.exe -p 9999 -i c:\cwRsync\ssh\test_id_rsa"
"/cygdrive/c/repository/blah.com/"
test#xx.xx.xxx.xxx:/home/test/public_html
Related
I used FileZilla to connect to one of my Linux servers via the SFTP protocol, but got below error stack trace.
Status: Connecting to <server_ip>...
Response: fzSftp started, protocol_version=5
Command: keyfile "C:\ruifeng_ibm.ppk"
Command: open "root#<server_ip>" 22
Status: Connected to <server_ip>
Error: Connection timed out after 20 seconds of inactivity
Error: Could not connect to server
On the server when I ran lsof -i, I was able to see the established sshd connection.
sshd 12333 root 3u IPv4 109406 0t0 TCP <server_hostname>:ssh-><workstation_ip>:54315 (ESTABLISHED)
How could the directories not be listed when the connection is successful? No idea how to debug either.
Turned out to be a silly problem.
I put below welcome message in the .bashrc file.
echo -e "\n\nHello Ruifeng...Welcome to the Arena! \n#>>------>---->>"
Either it contained some illegal characters FileZilla does not honor, or it's completely not supported by FileZilla. Too lazy to further dig in. After removing this message, the connection worked and the directories got listed.
I want to make a backup for my remote server folders(ubunto server)to another remote sever (Linux server). but once I run this command from the the first server it dispalys me an error message:
rsync -raz --progress firstdirectoy root#serverIP:/home
The displayed messahe is:
ssh: connect to host <serverIP> port 22: Connection timed out
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]
But the same command from the server 2 to the server 1 works fine and the folder is nicely copyed into the server1.
How can I escape the connexion error in order to copy my folder from server 1 to server 2 throw rsync?
Seems like server2 has no active ssh daemon while server1 has.
Try to run ssh daemon or use raw rsync protocol and rsync daemon.
If it's a connection timeout because your SSH server is slow to respond, you can tweak the timeout in rsync:
rsync -e 'ssh -o ConnectTimeout=120'
Else it may be a missing SSH daemon (sshd) on server 2 as stated by #geov, or a closed port on your firewall. You may start by testing an SSH login:
ssh user#serverIP
And see if it's working or not. Probably nmap serverIP will help you too, stating if SSH is running or not.
And please do NOT use root user for your rsync copy!
if you wait for a long time, the prompt appears
I think that your server2's IP is wrong
For me, this error appeared when attempting to rsync between two AWS EC2 instances where the two instances were not a part of the same security group.
Overview of how to create security groups
How to change the security groups of the instances
Allow instances within the same security group to communicate
I tried the following command to rsync from a server and got the following error message:
rsync -e ssh -avz name#home.com:/home/name/. .
receiving file list ... done
Desktop/Python_Nick/Python-2.4.1/
Desktop/Python_Nick/Python-2.4.1/Python/
Write failed: Broken pipe
rsync: writefd_unbuffered failed to write 4092 bytes [generator]: Broken pipe (32)
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-42/rsync/io.c(1121) [generator=2.6.9]
rsync error: received SIGUSR1 (code 19) at /SourceCache/rsync/rsync-42/rsync/main.c(1197) [receiver=2.6.9]
Sometimes it gives the following error:
Read from socket failed: Operation timed out
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [receiver=2.6.9]
Then sometimes the following error:
Write failed: Broken pipe
rsync: connection unexpectedly closed (314764 bytes received so far) [receiver]rsync: writefd_unbuffered failed to write 4092 bytes [generator]: Broken pipe (32)
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-42/rsync/io.c(1121) [generator=2.6.9]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [receiver=2.6.9]
I even tried using FETCH (The MAC application).
Any suggestions? The server is running LINUX and my local machine is a MAC
I had a similar problem, and my solution was to update rsync on my Mac.
As is clear from point 3 in the rsync "current issues and debugging" page, the "connection unexpectedly closed"
error tells you that the local rsync was trying to talk to the
remote rsync, but the connection to that rsync is now gone. The thing
you must figure out is why, and that can involve some investigative
work.
One of the first things suggested on this page is to update rsync. It turns out that Apple has not given us the latest rsync in their machines. Thus, I updated the rsync version on my Mac via Macports to 3.1.1. After that, I have had no problems syncing.
This is no general solution, of course, but then again there seem to be no general solution for this vague error message: if this had not worked, I had had to try and debug it. For details on how, see the above-mentioned rsync issues page.
[root#localhost ~]# rsync -aHXA /mnt/capture-tmp/source/ /mnt/capture-tmp/dest
rsync: writefd_unbuffered failed to write 4092 bytes to socket [sender]: Broken pipe (32)
rsync: write failed on "/mnt/capture-tmp/dest/opt/StorageManager/jre/lib/i386/server/libjvm.so": Read-only file system (30)
rsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
rsync: connection unexpectedly closed (135188 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]
"dest" is iscsi disk.I am not able to reason out the cause for the faliure??
Thank you.
Seems obvious enough:
rsync: write failed on "[...snip...]/libjvm.so": Read-only file system (30)
^^^^^^^^^^^^^^^^^^^^^^^^^^
Remount it as read/write and try again.
I have a server where I store data from Mac A and Mac B.
I use rsync to keep the files updated between my Macs.
I run the following code unsuccessfully
#!/bin/zsh
# to copy files from my server to my folder
rsync -Pav $Masi:~/private/ ~/Dropbox/Courses/math/
# to copy files from my folder to my server
rsync -Pav ~/Dropbox/Courses/math $Masi:~/private/
I get the following error message
ssh: connect to host port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.5]
ssh: connect to host port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.5]
I have ssh keys in place so the connection should work, since I can use scp without problems.
How can you use rsync between my server and one of my Macs?
I used to do a lot of this. Just ran a test, a few suggestions.
Spell out your entire user#host pattern
Run the ssh connection sans the rsync first, you may need to first approve your fingerprint
You do not seem to pass a flag to protect extended attributes, this can yield broken files on OS X. If you do not need resource forks, you are OK, but most of the time you do need them.
My test case:
$ rsync -Pav ~/Desktop/ me#remote.example.com:~/rsyc-test
In that case, all the files within ~/Desktop were copied to the remote host, in my home dir. Since the directory 'rsyc-test' did not exist, it was made for me. I had a .app on my Desktop, it made it over, surprisingly, it works. Even some .webloc files made it and appear to work, though I do not trust it.
I would strongly suggest adding in the -E flag
-E, --extended-attributes
Apple specific option to copy extended attributes, resource
forks, and ACLs. Requires at least Mac OS X 10.4 or suitably
patched rsync.
I ran a new test, moved a Interarchy bookmark to my desktop, I know for a fact these break if they are copied sans resource forks. Running without the -E versus with the -E, there is a difference of 152 bytes in xfered data. The first file on the remote machine did not work, the second transfered file did work.
I can not help but notice in your example one of your paths is ~/Dropbox so this may all not matter, since DropBox, the app, does not at all support resource forks currently, though I hear there are plans to in the future.
You also are not sending in the --delete flag, if your end goal is a mirror of your data, you are not getting that, if your end goal is backups that continually grows, keeping everything that was ever on the source, the lack of --delete is good.
Other notes:
You can exclude those silly .DS_Store files
--exclude '.DS_Store'
You can also set rsync up in a way to be a true mirror, so you would not need to run your other command, see the man page for details.
My final working command to shove the Desktop of my laptop to a remote machine:
$ rsync -PEav --delete --exclude '.DS_Store' ~/Desktop/ me#remote.example.com:~/rsycn-test
Check "$Masi". Is that the hostname you are trying to reach?
Try the following command to debug it:
rsync -e 'ssh -v' -Pav $Masi:~/private/ ~/Dropbox/Courses/math/
The Connection refused usually happens when there is a connection issue to the remote (e.g. firewall).
In your case the problem is that $Masi variable is empty. If it's not variable, use Masi.
As per this error:
ssh: connect to host port 22: Connection refused
Notice the double space above after the host word.
the connect to host message doesn't say to which host, so you're trying to connect to empty host. So it sound like a typo in the host name.