Re: [gentoo-user] rsync via ssh

2007-11-05 Thread Roger Mason
Shawn Haggett [EMAIL PROTECTED] writes:

 Roger Mason wrote:
 I have passwordless ssh between mymachine and backup_machine and the
 rsync command in the crontab runs perfectly from the command line.

 Does someone know what else needs to be done to get this (seemingly
 simple!) task to work?


 How have you setup the passwordless ssh? If your using keys with the
 ssh keyagent, then when the command is run in cron it wouldn't know
 where to find your ssh-agent...

Yes, I think that is the problem.  I'm going to try the technique
described here:

http://arctic.org/~dean/rdiff-backup/unattended.html

Will report back.

Cheers,
Roger
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-05 Thread W.Kenworthy

On Mon, 2007-11-05 at 07:34 -0330, Roger Mason wrote:
 Shawn Haggett [EMAIL PROTECTED] writes:
 
  Roger Mason wrote:
  I have passwordless ssh between mymachine and backup_machine and the
  rsync command in the crontab runs perfectly from the command line.
 
  Does someone know what else needs to be done to get this (seemingly
  simple!) task to work?
 
 
  How have you setup the passwordless ssh? If your using keys with the
  ssh keyagent, then when the command is run in cron it wouldn't know
  where to find your ssh-agent...
 
 Yes, I think that is the problem.  I'm going to try the technique
 described here:
 
 http://arctic.org/~dean/rdiff-backup/unattended.html
 
 Will report back.
 
 Cheers,
 Roger

Keep in mind that cron runs with a very limited environment for safety
reasons.  You have to manually set most env variables and the like.

BillK

-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh [solved]

2007-11-05 Thread Roger Mason
W.Kenworthy [EMAIL PROTECTED] writes:

  Roger Mason wrote:
  I have passwordless ssh between mymachine and backup_machine and the
  rsync command in the crontab runs perfectly from the command line.
 
  Does someone know what else needs to be done to get this (seemingly
  simple!) task to work?

 Yes, I think that is the problem.  I'm going to try the technique
 described here:
 
 http://arctic.org/~dean/rdiff-backup/unattended.html
 

 Keep in mind that cron runs with a very limited environment for safety
 reasons.  You have to manually set most env variables and the like.

Yes.  I finally have it working using the technique described in the
above URL.  

Thanks to all who responded.

Roger
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Roger Mason
Hi Richard,

Richard Ruth [EMAIL PROTECTED] writes:

 Try adding -e ssh to your rsync command.
 Search for -e in the rsync man page for an example.
 ===
 This is the crontab entry (in rmason's crontab):
 0,15,30,45 * * * *  rmason /usr/bin/rsync -av /home/rmason 
 backup_machine:my
 machine_rmason

Thanks for the reply.  Unfortunately that did not work, the same error
ocurs.  

This is what I have currently:
0,15,30,45 * * * *  /usr/bin/rsync -av -e ssh /home/rmason [EMAIL 
PROTECTED]:mymachine_rmason

I've tried with and without the quotes plus with and without the
rmason@ but none worked.

I think I'll try scp and see what happens.

Cheers,
Roger
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Dirk Heinrichs
Am Samstag, 3. November 2007 schrieb Roger Mason:
 Hello,

 I'm trying to use rsync to back up my home directory on mymachine to
 another machine (backup_machine) using a cron job.

Which cron?

 This is the crontab entry (in rmason's crontab):

 0,15,30,45 * * * *  rmason /usr/bin/rsync -av /home/rmason
 backup_machine:mymachine_rmason

Shouldn't this be 

0,15,30,45 * * * * /usr/bin/rsync -av /home/rmason 
backup_machine:mymachine_rmason

HTH...

Dirk


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Steve Dommett
On Sunday 04 November 2007, Roger Mason wrote:
 Thanks for the reply.  Unfortunately that did not work, the same error
 ocurs.
This may not be applicable, but I run rdiff-backup from cron on many machine 
with no problems at all.  It uses librsync, so may be of interest to you.
http://rdiff-backup.nongnu.org/
If you ignore the 'rdiff-backup-data' folder it creates then it's more or less 
identical to using rsync alone.

HTH,
  Steve.
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Ralph Slooten
I have done a similar thing at work, except what I do is first create an 
ssh tunnel, then rsync to the locally listening port. Works perfectly. 
In my setup the remote server is running an SSH server which is not 
accessible directly. Maybe this will help you.



#!/bin/bash
SSL_COMMAND=ssh -p  [EMAIL PROTECTED] -f -N -L 8000:localhost:873
SSL_PID=`ps aux | grep $SSL_COMMAND | egrep -v 'grep' | awk '{print $2}'`

if [ $SSL_PID ==  ]; then
echo = Creating SSH tunnel to myserver
$SSL_COMMAND
SSL_PID=`ps aux | grep $SSL_COMMAND | egrep -v 'grep' | awk 
'{print $2}'`

else
echo = SSH tunnel already exists. Using existing tunnel.
fi

if [ $SSL_PID !=  ]; then
echo = Connecting through SSH tunnel with PID $SSL_PID
rsync rsync://localhost:8000/wwwroot 
/mnt/samba/hotcopy/myserver/wwwroot \

-rvtzp --delete --modify-window=1

echo = Closing SSH tunnel
kill $SSL_PID
else
echo ERROR: SSH Connection failed! The backup could not complete
fi



Cheers,
Ralph

Roger Mason wrote:

Hi Richard,

Richard Ruth [EMAIL PROTECTED] writes:


Try adding -e ssh to your rsync command.
Search for -e in the rsync man page for an example.
===
This is the crontab entry (in rmason's crontab):
0,15,30,45 * * * *  rmason /usr/bin/rsync -av /home/rmason backup_machine:my
machine_rmason


Thanks for the reply.  Unfortunately that did not work, the same error
ocurs.  


This is what I have currently:
0,15,30,45 * * * *  /usr/bin/rsync -av -e ssh /home/rmason [EMAIL 
PROTECTED]:mymachine_rmason

I've tried with and without the quotes plus with and without the
rmason@ but none worked.

I think I'll try scp and see what happens.

Cheers,
Roger

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Roger Mason
Hi Dirk,

Dirk Heinrichs [EMAIL PROTECTED] writes:

 Am Samstag, 3. November 2007 schrieb Roger Mason:
 Hello,

 I'm trying to use rsync to back up my home directory on mymachine to
 another machine (backup_machine) using a cron job.

 Which cron?

vixie-cron

 This is the crontab entry (in rmason's crontab):

 0,15,30,45 * * * *  rmason /usr/bin/rsync -av /home/rmason
 backup_machine:mymachine_rmason

 Shouldn't this be 

 0,15,30,45 * * * * /usr/bin/rsync -av /home/rmason 
 backup_machine:mymachine_rmason

I already tried it without the rmason prepended to the command: no
difference.  FWIW I tried scp and had the same problems.  I think it
has to do with the backup_machine not reading my public ssh key, maybe
because the session is not interactive.

Thanks,
Roger 
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Roger Mason
Hi Steve,

Steve Dommett [EMAIL PROTECTED] writes:

 On Sunday 04 November 2007, Roger Mason wrote:
 Thanks for the reply.  Unfortunately that did not work, the same error
 ocurs.
 This may not be applicable, but I run rdiff-backup from cron on many machine 
 with no problems at all.  It uses librsync, so may be of interest to you.
 http://rdiff-backup.nongnu.org/
 If you ignore the 'rdiff-backup-data' folder it creates then it's more or 
 less 
 identical to using rsync alone.

Thanks, I'll have a look at it.

Did you have to do anything special to make it work from cron?

Cheers,
Roger
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Roger Mason
Hi Ralph,

Ralph Slooten [EMAIL PROTECTED] writes:

 I have done a similar thing at work, except what I do is first create
 an ssh tunnel, then rsync to the locally listening port. Works
 perfectly. In my setup the remote server is running an SSH server
 which is not accessible directly. Maybe this will help you.


 #!/bin/bash
 SSL_COMMAND=ssh -p  [EMAIL PROTECTED] -f -N -L 8000:localhost:873
 SSL_PID=`ps aux | grep $SSL_COMMAND | egrep -v 'grep' | awk '{print $2}'`

 if [ $SSL_PID ==  ]; then
 echo = Creating SSH tunnel to myserver
 $SSL_COMMAND
 SSL_PID=`ps aux | grep $SSL_COMMAND | egrep -v 'grep' | awk
 {print $2}'`
 else
 echo = SSH tunnel already exists. Using existing tunnel.
 fi

 if [ $SSL_PID !=  ]; then
 echo = Connecting through SSH tunnel with PID $SSL_PID
 rsync rsync://localhost:8000/wwwroot
 /mnt/samba/hotcopy/myserver/wwwroot \
 -rvtzp --delete --modify-window=1

 echo = Closing SSH tunnel
 kill $SSL_PID
 else
 echo ERROR: SSH Connection failed! The backup could not complete
 fi

Another responder suggested rdiff-backup.  I'll give that a try first.

Thanks,
Roger
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Steve Dommett
On Sunday 04 November 2007, Roger Mason wrote:
 Did you have to do anything special to make it work from cron?

No, but then the crontab entry is simply:
 47 4 * * * /root/backup.sh
The backup.sh is essentially:

rdiff-backup   \
  --print-statistics \
  --exclude /mnt \
  --exclude /dev \
  --exclude /proc \
  --exclude /tmp \
  --exclude /var/tmp \
  --exclude /var/cache/squid/ \
  --exclude /var/lib/mysql/ \
  --exclude /var/lib/postgresql/data/base/ \
  --exclude /var/lib/postgresql/data/global/ \
  --exclude /var/lib/postgresql/data/pg_clog/ \
  --exclude /var/lib/postgresql/data/pg_subtrans/ \
  --exclude /var/lib/postgresql/data/pg_tblspc/ \
  --exclude /var/lib/postgresql/data/pg_xlog/ \
  --exclude /sys \
  --exclude /usr/portage \
  --exclude /usr/portage/distfiles \
  --exclude /var/run \
 / [EMAIL PROTECTED]::/home/backups/hostname/
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Neil Walker

Please, please, please do not top-post. :(


Be lucky,

Neil


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Shawn Haggett

Roger Mason wrote:

I have passwordless ssh between mymachine and backup_machine and the
rsync command in the crontab runs perfectly from the command line.

Does someone know what else needs to be done to get this (seemingly
simple!) task to work?



How have you setup the passwordless ssh? If your using keys with the ssh 
keyagent, then when the command is run in cron it wouldn't know where to 
find your ssh-agent...


Shawn
--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] rsync via ssh

2007-11-04 Thread Steve Dommett
On Sunday 04 November 2007, Shawn Haggett wrote:
 Roger Mason wrote:
 How have you setup the passwordless ssh? If your using keys with the ssh
 keyagent, then when the command is run in cron it wouldn't know where to
 find your ssh-agent...

 Shawn

I use a use a key with no password without ssh-agent.
-- 
[EMAIL PROTECTED] mailing list



[gentoo-user] rsync via ssh

2007-11-03 Thread Roger Mason
Hello,

I'm trying to use rsync to back up my home directory on mymachine to another
machine (backup_machine) using a cron job.

This is the crontab entry (in rmason's crontab):

0,15,30,45 * * * *  rmason /usr/bin/rsync -av /home/rmason 
backup_machine:mymachine_rmason

The logs on backup_machine show entries like this when the cron job runs:

Nov  3 17:30:06 backup_machine sshd[22048]: error: PAM: Authentication failure 
for rmason from mymachine.esd.mun.ca
Nov  3 17:30:06 backup_machine sshd(pam_unix)[22052]: authentication failure;
 logname= uid=0 euid=0 tty=ssh ruser= rhost=mymachine.esd.mun.ca
 user=rmason

I have passwordless ssh between mymachine and backup_machine and the
rsync command in the crontab runs perfectly from the command line.

Does someone know what else needs to be done to get this (seemingly
simple!) task to work?

Many thanks,
Roger
-- 
[EMAIL PROTECTED] mailing list



RE: [gentoo-user] rsync via ssh

2007-11-03 Thread Richard Ruth

Try adding -e ssh to your rsync command.
Search for -e in the rsync man page for an example.


===

This is the crontab entry (in rmason's crontab):

0,15,30,45 * * * *  rmason /usr/bin/rsync -av /home/rmason 
backup_machine:mymachine_rmason
I have passwordless ssh between mymachine and backup_machine and the
rsync command in the crontab runs perfectly from the command line.

Does someone know what else needs to be done to get this (seemingly
simple!) task to work?