store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Tue Jun 18, 2013 12:46 am

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 7 posts ] 
Author Message
 Post subject: Cron for website
Unread postPosted: Wed Sep 07, 2011 9:04 am 
Offline
Forum Regular
Forum Regular

Joined: Tue May 10, 2005 1:24 pm
Posts: 193
I have a Plesk 10 server and I have a user that needs to run some php cron scripts that login to their mysql db and make some changes each night. I tried to allow them a chrooted environment, but php and mysql are not available in that environment. I was able to get php running and all the libraries loaded, by copying what was need for them, but I can't get php to load the mysql library. Does anyone know if this is the best way to do this? Is there a better, safer way to allow this? If this is the best way, how do I load mysql with php in this chrooted environment?


Top
 Profile  
 
 Post subject: Re: Cron for website
Unread postPosted: Wed Sep 07, 2011 10:48 am 
Offline
Forum Regular
Forum Regular

Joined: Mon Apr 10, 2006 12:55 pm
Posts: 656
I thought Plesk did cron jobs for them under their FTP user

_________________
"Its not a mac. I run linux... I'm actually cool." - scott


Top
 Profile  
 
 Post subject: Re: Cron for website
Unread postPosted: Wed Sep 07, 2011 12:35 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue May 10, 2005 1:24 pm
Posts: 193
It is run under their ftp user. But that has no access to php. It seems like the cron jobs run chrooted. Is that not right? I enter a job with the command "php -q /path/to/file" and I get "php: command not found" or "/usr/bin/php -q /path/to/file" and I get "/usr/bin/php: No such file or directory".


Top
 Profile  
 
 Post subject: Re: Cron for website
Unread postPosted: Wed Sep 07, 2011 12:43 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue May 10, 2005 1:24 pm
Posts: 193
I do know that I can set the ssh setting under Web Hosting Settings to /bin/bash and it will work, but is that a good idea? If I set that to forbidden (which I normally do), it seems to be chrooted when it runs.


Top
 Profile  
 
 Post subject: Re: Cron for website
Unread postPosted: Thu Sep 08, 2011 8:38 am 
Offline
Forum Regular
Forum Regular

Joined: Mon Apr 10, 2006 12:55 pm
Posts: 656
So you're testing this with the CLI? And there's two /bin/bash, one is chrooted (at least in mine there is)

_________________
"Its not a mac. I run linux... I'm actually cool." - scott


Top
 Profile  
 
 Post subject: Re: Cron for website
Unread postPosted: Thu Sep 08, 2011 9:47 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1872
Personally I simply do a wget via http.

e.g.:
Code:
wget -q -O /dev/null http://www.whatever.tld/directory/file.php


And I seem to recall that wget has options that allow you to specify username/password credentials, so you can place the file you want to run in a proteted directory so that it doesn't get accidentally run or accessed by anyone.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Cron for website
Unread postPosted: Thu Sep 08, 2011 8:47 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue May 10, 2005 1:24 pm
Posts: 193
highland - Yes, there are two. If I set it to /bin/bash, the cron job runs fine, but I really don't want to give this user that access to the system. If I set it to /bin/bash (chrooted), I run into the original problem that php is unknown. So that is when I started copying files to to that web users directory so they would have access to php in their chrooted environment. I got all the libraries needed to run php, I just can't get php to use the mysql library. If I could get that part working, I would be set.

faris - Great idea. I might just settle on this idea as it will cause the least amount of configuration changes to get the same result.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 7 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group