[SunHELP] Rsync with SSH

Ben Ricker sunhelp at sunhelp.org
Thu Oct 25 14:23:59 CDT 2001


On Thu, 2001-10-25 at 04:02, Devrim Yilmaz (Garanti Teknoloji) wrote:

Hi Ben;
It is similiar. I want to rsync from one server to other server. I need
information about how to use rsync with ssh for both sides. Also i want
to know how i can up rsync deamon with ssh in "inetd.conf" file. Any
documents, links or tips will make me happy..

Thx.

As the previous poster mentioned, you use the 'e' options and then 'ssh'
to tell rsync to use ssh as the transport agent. The somewhat touggh
part is scripting it. Normally, people use password authentication for
ssh (and security wise, that is most smart). But when scripting, one
cannot use passwords because they break scripts. Here is how I do it:

1. Get on the client machine as the user who is going to run the script
(I use root most of the time).

2. Depending on what version of ssh you have, type in the following:
'ssh-keygen -t dsa'. The 'dsa' is the type fo key to create. It will say
soemthing like "Generating Key...." and then ask you where to save it.
It should default to '~/.ssh/id_dsa' and '~/.ssh/id_dsa.pub'. Use the
defaults.

3. Go to the server that will be the rsync server (I will talk about
inetd later). Become the user that will you will login as (I again use
root). In the directory, there should be a '.ssh' directory. Go into
that directory and look for a file called 'authorized_keys2'. If there
is not file there, create it with 600 permissions. Then, copy and paste
the contents of the id_dsa.pub key into the 'authorized_keys2' file.
Save it.

4. On the client, ssh to the server as the user you just created the
'authorized_keys2' file in and you should not be prompted for a
password. If it works, then you can script rsync!

As for running rsync and ssh through inetd, here is what I have in my
inetd.conf for ssh:

 ssh    stream  tcp     nowait  root    /usr/local/sbin/tcpd   
/usr/local/sbin/sshd -i

(The above is all one line)

and rsync: 

rsync    stream  tcp     nowait  root    /usr/local/sbin/tcpd   
/usr/local/sbin/rsync

The 'tcpd' is what is known as TCP-Wrappers, a way to finely control
host access to daemons run through inetd. If you do not have it
installed, just replace the '/usr/local/sbin/tcpd' with the path to
rsync. Here is what it looks like without tcp-wrappers:

rsync    stream  tcp     nowait  root    /usr/local/sbin/rsync   rsync

Btw, there are tabs between each section in the inetd.conf.

Also, this is all in the ssh and rsync docs.

Good Luck!

Ben Ricker
System Administrator
Wellinx.com

-----Original Message-----
From: Ben Ricker [mailto:bricker at wellinx.com]
Sent: Wednesday, October 24, 2001 7:09 PM
To: 'sunhelp at sunhelp.org'
Subject: Re: [SunHELP] Rsync with SSH


I rsync from two Sun boxes to a central backup server through ssh. What
sort of information do you need?

Ben Ricker
System Administrator
Wellinx.com


On Wed, 2001-10-24 at 09:49, Devrim Yilmaz (Garanti Teknoloji) wrote:

Hi friends;

I want to use rsync with ssh. Is there any experienced one about this
issue?

Thx and regards,
dEVRim-


_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp





More information about the SunHELP mailing list