ssh through cron scripts.

Discussion in 'Mac Apps and Mac App Store' started by knome, Mar 9, 2009.

  1. knome macrumors 6502


    Sep 7, 2006
    I'm having issues setting up cron scripts that log into a server automatically via ssh.

    I created the automatic ssh login using this:

    i followed this how to in order to set the the cron job:

    I tested the scrip manually but it still requires me to enter the password for the ssh login. But if i manually type it in the console it logs me into the server instantly without a password.

    So how do you get the auto ssh login to work inside of scripts?

    How do i check to see if my cron job has been added?

    here is the scrip i am trying to run

    rsync -v -r -z -u --exclude '.DS_Store' user@myserver:/media/extra/backups/projects/ /Users/myusername/Documents/Projects/
    Here is the code that i injected into the crontab

    0 * * * * /etc/periodic/hourly/*
  2. angelwatt Moderator emeritus


    Aug 16, 2005
  3. knome thread starter macrumors 6502


    Sep 7, 2006
    Thats what has me confused. I did this about 9 months ago with a different computer and the same server for backups and i don't have a line like that in the cron file and it works just fine. I have absolutely no idea what i did.
  4. knome thread starter macrumors 6502


    Sep 7, 2006
    Well now i have to start from scratch. I was messing with it and now not only is my old one not working but i can't get any type of auto login to work now. :mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad:
  5. Beerfloat macrumors regular


    Feb 21, 2009
    crontab -l [optionally -u username]

    Keep in mind that every user has their own crontab file, and their own .ssh/authorized_keys file

    It sounds like you may not be running your script with the same user that is allowed in the remote authorized_keys

Share This Page