Solved

RSYNC over SSH to the DAEMON

Posted on 2004-08-04
12
682 Views
Last Modified: 2013-12-06
Hi
I want to RSYNC via SSH (for encryption only) to a remote server and use the Daemon to allow/grant access access to the modules using the normal auth users option.  


I am have tried the following syntax,
RSYNC -va -e ssh.exe auth_user@1.2.3.4::module_name
and
RSYNC -v -e "ssh.exe ssh_user@1.2.3.4" auth_user@1.2.3.4::module_name

but,
ssh.exe ssh_user@1.2.3.4
works fine as I have the public/private keys setup.

Any ideas anyone? Is this possible?  Certainly likes it it from the manual but can't quite get it to work!

Thanks
 
0
Comment
Question by:carillian
  • 7
  • 5
12 Comments
 
LVL 1

Expert Comment

by:tkrabec
ID: 11716649
I use ssh via cygwin on my xp box.

I use rsync -av -e ssh . server.com:backup
I have the username set via set USERNAME=ssh_user in the batch file before I use rsync
as well as
SET TERM = ansi
set HOME = c:\
set RSYNC_RSH=ssh.exe

Hope that helps
-- Tim
0
 

Author Comment

by:carillian
ID: 11716883
Hi Tim,

I can get RSYNC over SSH to work but I was wondering how I get RSYNC over SSH to the DAEMON to work properly.  I see bits of information around but cannot get it work.

My example,
rsync -av -e "ssh_user@1.2.3.4" 1.2.3.4::
keeps resulting in the error message
bash: line1 : 1.2.3.4 : command not found

however,
rsync -av 1.2.3.4:: works aboslutely fine

Steve
0
 
LVL 1

Expert Comment

by:tkrabec
ID: 11716966
Are you on linux or windows?
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:carillian
ID: 11717285
I'm on win xp running cygwin and need to transfer securely to linux red hat 9
0
 
LVL 1

Expert Comment

by:tkrabec
ID: 11717327
ok I have a similar set up I run thru a batch file.

Do you wan tthe rsync user to login automatically?

I use rsync outside of the cygwin shell, and I strictly call rsync and ssh.

-- Tim
0
 

Author Comment

by:carillian
ID: 11717742
Okay, the aim is logon the user automatically and securely.

The daemon only is an issue because of the clear text passwords and non-encryption during transport issue.  We can wrap this up with stunnel but that comes with it's own stack of stuff.

I would like to use ssh for secure authentication and encrypted transport and the daemon to further authenticate and organise the rsync file access rather than give them shell access.

hope this makes sense, I have seen things about running across ssh to get to the daemon but cannot get it to work.

Steve
0
 
LVL 1

Expert Comment

by:tkrabec
ID: 11717921
I hate to say it but I am now more confused.
Do you basically want to use rsync with ssh to back up files to a remote machine then have a Daemon(process)  put the files in to some kind of organized structure?

-- TIm
0
 

Author Comment

by:carillian
ID: 11727064
Okay, trying simply I want to use RSYNC over SSH but require the DAEMON still to control authentication, the website http://samba.anu.edu.au/ftp/rsync/rsync.html seems to explain this is possible but I cannot get it to work correctly.

a) rsync --rsh="ssh -l (ssh_user)" 1.2.3.4::
correctly returns the list of available modules at the daemon

b) rsync -- rsh="ssh -l (ssh_user)" (daemon_user)@1.2.3.4::(module)/
should return the contents at that module but instead I get the following msg

@ERROR: chroot failed
rsync: connection unexpextedly closed (75 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(342)

I do not get any errors in my rsyncd.log, in fact I find nothing in the log at all!

Thanks Steve



http://samba.anu.edu.au/ftp/rsync/rsync.html
----------------------------------------------------------------------------------------------------------------------------
CONNECTING TO AN RSYNC SERVER OVER A REMOTE SHELL PROGRAM
It is sometimes useful to be able to set up file transfers using rsync server capabilities on the remote machine, while still using ssh or rsh for transport. This is especially useful when you want to connect to a remote machine via ssh (for encryption or to get through a firewall), but you still want to have access to the rsync server features (see RUNNING AN RSYNC SERVER OVER A REMOTE SHELL PROGRAM, below).

From the user's perspective, using rsync in this way is the same as using it to connect to an rsync server, except that you must explicitly set the remote shell program on the command line with --rsh=COMMAND. (Setting RSYNC_RSH in the environment will not turn on this functionality.)

In order to distinguish between the remote-shell user and the rsync server user, you can use '-l user' on your remote-shell command:

rsync -av --rsh="ssh -l ssh-user" rsync-user@host::module[/path] local-path
The "ssh-user" will be used at the ssh level; the "rsync-user" will be used to check against the rsyncd.conf on the remote host.
----------------------------------------------------------------------------------------------------------------------------------------
0
 
LVL 1

Expert Comment

by:tkrabec
ID: 11727572
I went into /etc/xinetd.d and edited the rsync entry making sure it was enabled.  I went from getting error code 10 to error code 12
I aslo use the command rsync user@dom:: --verbose --verbose it has given me a little more information.  Hope this ehelps some I will look at getting you more info soon

-- Tim
0
 
LVL 1

Expert Comment

by:tkrabec
ID: 11824205
I think I have found the answer.  I got rsync set up on my windows server(s) both as client and server
I used cwrsync(a cywgin port of just rsync)
I added modules in the rsyncd.conf file with the following format
[test]
path = /cygdrive/d/data
read only = false
transfer logging = yes
[test2]
path = /cygdrive/d/data2
read only = false
transfer logging = yes

then when I type in the command rsync server::
I saw the above modules

to sync to them I used rsync -bavz *.* server::test/

and it worked beautifully

-- Tim
0
 
LVL 1

Accepted Solution

by:
tkrabec earned 500 total points
ID: 11824271
this rsync -bavz *.* server::test/ did not do subdirectories

rsync -bavz /cygdrive/d server::test/ gets sub directories
while
rsync -bavz /cygdrive/d/ server::test/ gets sub directories  but does not make a d under test

-- Tim
0
 

Author Comment

by:carillian
ID: 12288712
this did not really solve the question
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question