Hi ? I put the rsync in cronjob but it won't work ? in root user cron ? */30? * * * *? /home/chloe/rsy.sh >/dev/null 2>&1 ? 1/ why it needs pw when I run this rsy.sh in root? but if I run it in chloe user, it doesn't need pw as I put authoized_key in remote host chloe ? 2/ why this root cronjob is not working? what wrong? I can't see this cron in message ? the rsy.sh is below ? #! /bin/sh rsync -essh -av chloe at remotehost:/var/www/html /backup/html ? Thank you __________________________________________________________________ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20090903/35f34702/attachment-0001.html>
chloe K wrote:> Hi > > I put the rsync in cronjob > but it won't work > > in root user cron > > */30 * * * * /home/chloe/rsy.sh >/dev/null 2>&1 > > 1/ why it needs pw when I run this rsy.sh in root? > but if I run it in chloe user, it doesn't need pw as I put > authoized_key in remote host chloe > > 2/ why this root cronjob is not working? what wrong? I can't see this > cron in message > > the rsy.sh is below > > #! /bin/sh > rsync -essh -av chloe at remotehost:/var/www/html > <mailto:chloe at remotehost:/var/www/html> /backup/html > > Thank you > >Hi Chloe, As root the rsync has no access to your keys - run this job as yourself rather than root. HTH Rob> ------------------------------------------------------------------------ > Ask a question on any topic and get answers from real people. *Go to > Yahoo! Answers.* <http://ca.answers.yahoo.com> > ------------------------------------------------------------------------ > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-------------- next part -------------- A non-text attachment was scrubbed... Name: rkampen.vcf Type: text/x-vcard Size: 121 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20090903/ee3ad8b8/attachment-0001.vcf>
chloe K wrote:> Hi > > I put the rsync in cronjob > but it won't work > > in root user cron > > */30 * * * * /home/chloe/rsy.sh >/dev/null 2>&1 > > 1/ why it needs pw when I run this rsy.sh in root? > but if I run it in chloe user, it doesn't need pw as I put authoized_key > in remote host chloeAssuming your key doesn't need a passphrase, authorized keys work because the remote side has the public part which is uses to make sure that the connecting process can read the private part - which, unless you say otherwise, is expected to be in $HOME/.ssh/> > 2/ why this root cronjob is not working? what wrong? I can't see this > cron in message > > the rsy.sh is below > > #! /bin/sh > rsync -essh -av chloe at remotehost:/var/www/html > <mailto:chloe at remotehost:/var/www/html> /backup/htmlIf it works when logged in as yourself, the right identity key is probably in your own $HOME/.ssh/ directory. If you gave a passphrase when you created the keys, then it is a bit more complicated. -- Les Mikesell lesmikesell at gmail.com
check this out if you wish to do root based server backups or whatever http://www.jms1.net/code/rsync-backup.shtml - rh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20090903/ced6e0c6/attachment-0001.html>
Try this ... On your script ... /usr/bin/rsync -avzh -e "ssh -i /home/user/.ssh/auth-key" chloe at remotehost:/var/www/html /backup/html Gabe On 9/3/09 4:06 PM, "chloe K" <chloekcy2000 at yahoo.ca> wrote:> Hi > > I put the rsync in cronjob > but it won't work > > in root user cron > > */30 * * * * /home/chloe/rsy.sh >/dev/null 2>&1 > > 1/ why it needs pw when I run this rsy.sh in root? > but if I run it in chloe user, it doesn't need pw as I put authoized_key in > remote host chloe > > 2/ why this root cronjob is not working? what wrong? I can't see this cron in > message > > the rsy.sh is below > > #! /bin/sh > rsync -essh -av chloe at remotehost:/var/www/html > <mailto:chloe at remotehost:/var/www/html> /backup/html > > Thank you > > > > Ask a question on any topic and get answers from real people. Go to Yahoo! > Answers. <http://ca.answers.yahoo.com> > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20090903/c3506050/attachment-0001.html>
Gabriel Rosca wrote:> Try this ... On your script ... > > /usr/bin/rsync -avzh -e "ssh -i /home/user/.ssh/auth-key" > chloe at remotehost:/var/www/html /backup/htmlYou are correct about the -i switch. Another possibility coming to me mind (if the machine the cronjob is running is not the local machine but remote per ssh): maybe chloe K is using Authentication forwarding (see the -A -a switches to ssh). If so, maybe the private key is only existing on the local machine but not on the machine the cronjob is running. -- best regards, markus
chloe K wrote:> Hi > > I put the rsync in cronjob > but it won't work > > in root user cron > > */30 * * * * /home/chloe/rsy.sh >/dev/null 2>&1 > > 1/ why it needs pw when I run this rsy.sh in root? > but if I run it in chloe user, it doesn't need pw as I put > authoized_key in remote host chloe > > 2/ why this root cronjob is not working? what wrong? I can't see this > cron in message > > the rsy.sh is below > > #! /bin/sh > rsync -essh -av chloe at remotehost:/var/www/html > <mailto:chloe at remotehost:/var/www/html> /backup/html > > Thank you > > > ------------------------------------------------------------------------ > Ask a question on any topic and get answers from real people. *Go to > Yahoo! Answers.* <http://ca.answers.yahoo.com> > ------------------------------------------------------------------------ > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >Hi Chloe, How did you create your cron table? You have to craete it with crontab and not with vi for it to be effective. ChrisG