LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-19-2014, 07:44 PM   #1
wolfsden3
LQ Newbie
 
Registered: Jun 2012
Posts: 9

Rep: Reputation: Disabled
rsync:// behavior is weird


Ubuntu 12.04 LTS

Trying to script out rsync over ssh and I have EVERYTHING working however I get weird behavior with the rsync:// command. What I tweaked:

Code:
/etc/ssh/ssh_config - To allow forwarding and id_rsa so I use ssh keys
/home/user/.ssh/config - To setup ssh specific stuff so it would just "work" with all the localhost commands
/home/user/.ssh/id_rsa - That's the key referenced in ssh_config


If I do this and the folder "rsync" doesn't exist it errors out but WHY it even uses the folder I have no clue! That's what I really want to know is WHY is it trying to append an "rsync" on the end of the path?



Code:
rsync -PavzrH -e "ssh host1.somehost.com" --delete --force --stats --itemize-changes --log-file=/var/log/rsync_bkp.log /var/ftp/test rsync://someuser@localhost:localhost:/mnt/da0p1/user_bkp_folder


Error:

Code:
sending incremental file list
rsync: change_dir#4 "/mnt/da0p1/user_bkp_folder/rsync" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(880) [Receiver=3.0.7]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]


BUT, if I do a "mkdir /mnt/da0p1/user_bkp_folder/rsync" and therefore the folder exists it works just fine.



Quote:
rsync -PavzrH -e "ssh host1.somehost.com" --delete --force --stats --itemize-changes --log-file=/var/log/rsync_bkp.log /var/ftp/test rsync://someuser@localhost:localhost:/mnt/da0p1/user_bkp_folder
sending incremental file list
cd+++++++++ test/
<f+++++++++ test/pw
26 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/2)

Number of files: 2
Number of files transferred: 1
Total file size: 26 bytes
Total transferred file size: 26 bytes
Literal data: 26 bytes
Matched data: 0 bytes
File list size: 36
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 123
Total bytes received: 35

sent 123 bytes received 35 bytes 316.00 bytes/sec
total size is 26 speedup is 0.16


So the folders and files make it to the remote server via ssh passwordless authentication with ssh keys but that darn "rsync" appending is irritating. I can live with it BUT I'd rather get this right :-)

Any help in understanding what's going on would be appreciated.
 
Old 09-20-2014, 01:47 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
Quote:
rsync -PavzrH -e "ssh host1.somehost.com" --delete --force --stats --itemize-changes --log-file=/var/log/rsync_bkp.log /var/ftp/test rsync://someuser@localhost:localhost:/mnt/da0p1/user_bkp_folder
Please post your users .ssh/config file just so we can see what you are tweaking. The correct syntax would be like the following.

rsync -PavzrHe ssh --delete --force --stats --itemize-changes --log-file=/var/log/rsync_bkp.log /var/ftp/test/ user1@host1.somehost.com:/destination/directory

The /destination/directory must exist.
 
Old 09-20-2014, 02:00 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
would be nice to explain this rsync:// part, that is not really compatible with -e "ssh <host>". If you want to use ssh you do not need rsync://.
 
1 members found this post helpful.
Old 09-21-2014, 07:44 PM   #4
wolfsden3
LQ Newbie
 
Registered: Jun 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
config

So my config in ~/.ssh/config is:

Host host1.somehost.com
HostName host1.somehost.com
Port 10003
User someuser
IdentityFile ~/.ssh/id_rsa
LocalForward 11000 127.0.0.1:873
AddressFamily inet
BatchMode yes
ForwardAgent yes
ClearAllForwardings yes

I can only somewhat remember a little bit why I'm doing the LocalForward but won't waste time explaining - in short it was probably because I was trying to tunnel over it.

Your solution works perfectly! I don't believe I need that LocalForward since I'm not using "localhost" anymore but rather the fqdn of the host I want to rsync to.

For one reason or another I couldn't see the forest through the trees because I kept focusing on connecting to the daemon (-e switch) and using the rsync://.

Thanks to all for the proper syntax and explanation!

It's solved and working as I have expected it to.
 
Old 09-22-2014, 12:08 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
if it is solved please mark the thread solved. also if you want to say thanks just press yes.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync with scp behavior jjj0923 Linux - Newbie 3 07-12-2011 08:22 AM
rsync behavior with symlinks keviny22 Linux - Software 2 02-28-2011 12:59 PM
can't understand rsync's behavior at all baronsam Linux - Software 5 08-15-2006 01:46 PM
Weird behavior!! surfer41 Linux - Networking 1 04-25-2006 07:53 AM
Weird behavior Bassy Linux - Software 2 10-20-2005 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration