tibberous Posted April 19, 2008 Share Posted April 19, 2008 When I type the line, crontab -u nobody /home/express/public_html/control/crontabs/process.cron, into putty, it works. Same line, shell_exec("crontab -u nobody /home/express/public_html/control/crontabs/process.cron"); Doesn't work. /etc/crontab and /usr/bin/crontab are both set to 777. I tried changing crontab to /usr/bin/crontab I just don't know what else to do, shell_exec doesn't seem to work anything like real shell commands. I get NO output, it just doesn't work. Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 19, 2008 Share Posted April 19, 2008 do you get any errors? Quote Link to comment Share on other sites More sharing options...
tibberous Posted April 19, 2008 Author Share Posted April 19, 2008 No. I think my problem might because PHP is running it as nobody, and I'm running it as root, but there is no reason why it should matter because I changed the permissions on everything. ... If I set UID, it doesn't let me run the script at all. Is there a way to set PHP to run everything as root? Quote Link to comment Share on other sites More sharing options...
tibberous Posted April 19, 2008 Author Share Posted April 19, 2008 I created a new user, and ran the line: su shell -c "/usr/bin/crontab -e" And I get: cron/shell: Permission denied Even though the file is set to 777. If I wanted an unusable level of security, I would have used Vista. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 19, 2008 Share Posted April 19, 2008 does your apache user have access to crontab? each user (including apache2 or www-root) gets their own user rights. Quote Link to comment Share on other sites More sharing options...
discomatt Posted April 19, 2008 Share Posted April 19, 2008 If the file is set to 777, every user should get permission. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 19, 2008 Share Posted April 19, 2008 not the file. Does your apache user have access to use crontab? Quote Link to comment Share on other sites More sharing options...
tibberous Posted April 19, 2008 Author Share Posted April 19, 2008 How can I tell? I don't think anyone except root can use the -u, and -e opens it up in vim. I can change the file, but the changes don't update unless I use crontab -u. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 19, 2008 Share Posted April 19, 2008 do this: figure out which username your web service runs under: cat /etc/passwd Next, as root: su <username> then attempt to run the code as them If it fails, then the apache user can't run it. 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.