Monk3h Posted July 30, 2008 Share Posted July 30, 2008 Is it possible to secure a cron by: <?PHP $IP = (isset($_SERVER['HTTP_X_FORWARDED_FOR']))?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']; if ($IP = $SERVERIP){ $CRONSCRIPT } ?> Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 30, 2008 Share Posted July 30, 2008 What? Why not just throw it in a directory outside of webroot? Quote Link to comment Share on other sites More sharing options...
Nhoj Posted July 31, 2008 Share Posted July 31, 2008 The best way to secure a cron job would be to put it outside an accessable directory. For example, if your web documents are served from /home/user/public_html, put your crons in /home/user/crons, that way no one can access them except the server itself or people with FTP access. Quote Link to comment Share on other sites More sharing options...
Monk3h Posted July 31, 2008 Author Share Posted July 31, 2008 What would the Cron command be if the file was in there? Quote Link to comment Share on other sites More sharing options...
trq Posted July 31, 2008 Share Posted July 31, 2008 In where? Cron expects full paths to files, so, give it the complete path. Quote Link to comment Share on other sites More sharing options...
Monk3h Posted July 31, 2008 Author Share Posted July 31, 2008 public_html/resetscript.php Quote Link to comment Share on other sites More sharing options...
Monk3h Posted July 31, 2008 Author Share Posted July 31, 2008 ** /home/user/crons Quote Link to comment Share on other sites More sharing options...
Monk3h Posted July 31, 2008 Author Share Posted July 31, 2008 /bin/sh: /home/usr/crons/: No such file or directory Cron Tab: /home/usr/crons/ curl res.php Quote Link to comment Share on other sites More sharing options...
Monk3h Posted July 31, 2008 Author Share Posted July 31, 2008 Bump? Quote Link to comment Share on other sites More sharing options...
trq Posted July 31, 2008 Share Posted July 31, 2008 Have you got a question? Quote Link to comment Share on other sites More sharing options...
Monk3h Posted August 1, 2008 Author Share Posted August 1, 2008 What would the Cron command be if the file was in there? there being /home/usr/crons/ Quote Link to comment Share on other sites More sharing options...
Monk3h Posted August 2, 2008 Author Share Posted August 2, 2008 For the record, the correct command is.. /usr/local/bin/php /home/<user>/crons/ Thanks for the help. ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.