LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsync:// behavior is weird (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-behavior-is-weird-4175519474/)

wolfsden3 09-19-2014 07:44 PM

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.

michaelk 09-20-2014 01:47 PM

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.

pan64 09-20-2014 02:00 PM

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://.

wolfsden3 09-21-2014 07:44 PM

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.

pan64 09-22-2014 12:08 AM

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


All times are GMT -5. The time now is 05:03 PM.