On Wednesday 18 October 2006 10:00, [EMAIL PROTECTED] wrote:
> I have a script to backup a VMWare virtual machine which when run manually
> on the box by root runs OK, but when run by cron...well, it doesn't.
>
> This is the script ....
>
> echo VMSNAP Backup Script
> echo _____________________________________________
> rm -f /vmimages/localbackup/###-###-REP1/*
> rm -f /vmimages/localbackup/###-###-VDB1/*
> echo Old images erased, new backup started
> date
> /usr/sbin/vmsnap_all
> echo Backup complete, copy started
> date
> scp -r /vmimages/localbackup/* 192.168.0.1:/vmimages/from_vm1
> echo Copy complete, script exiting
> date
>
>
>
> /var/log/messages   shows
>
> Oct 15 16:30:05 RKI-SYD-VM1 sshd(pam_unix)[5470]: session opened for user
> root by (uid=0)
> Oct 15 16:30:05 RKI-SYD-VM1 sshd(pam_unix)[5470]: session closed for user
> root
> Oct 15 16:30:12 RKI-SYD-VM1 sshd(pam_unix)[5533]: session opened for user
> root by (uid=0)
> Oct 15 16:30:12 RKI-SYD-VM1 sshd(pam_unix)[5533]: session closed for user
> root
> Oct 15 16:30:17 RKI-SYD-VM1 sshd(pam_unix)[5549]: session opened for user
> root by (uid=0)
>
> The script is set to run at 4:30pm
>
> /var/log/cron shows it starting ...
>
> Oct 17 16:30:00 RKI-SYD-VM1 CROND[16132]: (root) CMD (/root/vm1_snap.sh  
> #Daily vmsnap backup script)
>
> There is nothing in /etc/pam.d/cron
>
>
> Could someone please tell me why it may not be working. Why does it say
> about an ssh session opening? I think it may be a pam issue but my skills
> are a bit patchy with how cron,pam and ssh all work together.


Um how about step by step:
Can root on machineA ssh to machineB without password?
If NO then on machineA do ssh-keygen -t rsa (as root)
copy id_rsa.pub to .ssh/authorized_keys (sic) on machineB (also using ~root)

Now you ought to be able to ssh to machineB without password
Now the backup should run

James
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to