Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 23rd February 2008, 20:36
daveb daveb is offline
Senior Member
 
Join Date: Dec 2006
Location: St Louis Mo
Posts: 272
Thanks: 43
Thanked 41 Times in 37 Posts
Default Using crontab in a jailed enviroment

The last few days I been trying to get crontabs working in a chroot jail so users within that jail can add cron jobs. So far I am able to create cron jobs via crontab via jailed users which is getting me closer to the goal. The problem at the moment is the cron jobs are not executed and I can find no log info of errors . This is currently what I have done and would appreciate any help on this.
Code:
using a debian etch base install nothing more for testing
I did this using the howto http://www.howtoforge.com/chroot_ssh_sftp_debian_etch
using section 2 - 2.3 of howto

apps added to create_chroot_env script:
/bin/cat
/bin/chmod
/bin/touch
/bin/nano
/usr/bin/editor
/usr/bin/crontab
/usr/bin/nano
/usr/sbin/cron  <-- not sure if needed within chroot..

dir's and files added to chroot enviroment:
cd /home/chroot
mkdir lib/terminfo
mkdir lib/terminfo/x
cp /lib/terminfo/x/* ./lib/terminfo/x/
mkdir tmp
chmod 1777 tmp
mkdir var
mkdir var/spool
mkdir var/spool/cron
mkdir usr/sbin
cp -R /var/spool/* ./var/spool/
cp -R /var/spool/cron/* ./var/spool/cron/
chmod 1733 var/spool/cron/crontabs        <--- confused as I had to add chmod "other with writable and exacutable permisions"
chown root:crontab var/spool/cron/crontabs
chown daemon:daemon var/spool/cron/atjobs
chmod 1770 var/spool/cron/atjobs
chown daemon:daemon var/spool/cron/atspool
chmod 1770 var/spool/cron/atspool
Thanks Dave
Reply With Quote
Sponsored Links
  #2  
Old 24th February 2008, 14:18
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

Are you using full paths for your cron jobs?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 24th February 2008, 19:25
daveb daveb is offline
Senior Member
 
Join Date: Dec 2006
Location: St Louis Mo
Posts: 272
Thanks: 43
Thanked 41 Times in 37 Posts
Default

falko, over that last few days I have tried both full path and chroot'd path with no success.
Reply With Quote
  #4  
Old 25th February 2008, 17:18
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

Can you become a chrooted user and try to execute one of the cron jobs as this user from within the chroot jail?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 25th February 2008, 19:13
daveb daveb is offline
Senior Member
 
Join Date: Dec 2006
Location: St Louis Mo
Posts: 272
Thanks: 43
Thanked 41 Times in 37 Posts
Default

Yes as the jailed user I can execute. as testuser I can crontab -l and get list of tasks, but if I am root and check the crontab -u testuser -l their is no crontab listed. Could it be that cron isnt aware that their are crontabs within the jail.
Maybe Hans has got a bit further then I have.

Last edited by daveb; 25th February 2008 at 19:18.
Reply With Quote
  #6  
Old 26th February 2008, 19:20
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

Hm... Not sure where the problem is...
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 26th February 2008, 19:33
daveb daveb is offline
Senior Member
 
Join Date: Dec 2006
Location: St Louis Mo
Posts: 272
Thanks: 43
Thanked 41 Times in 37 Posts
Default

yea I am a bit confused. I am anxiously waiting to see if Hans might have had any luck over the weekend. either way I will keep trying.
Reply With Quote
  #8  
Old 26th February 2008, 21:09
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 210
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
Default

@Daveb,

This weekend i had some time to test your solution. Thanks! With your solution i can create cron tabs indeed for the jailed system users which are created by ISPConfig. Now, I have the same problem as you do: the cronjobs can't be executed. I don't want to do some tricky things, as i don't want to screw the configuration of my testserver.

In the past i had also a problem with executing cronjobs...
What i did was:

/etc/init.d/cron stop
pkill cron (Make sure no cron processes are left.)
Edit your crontab (crontab -e) and save it again.
Then restart cron: /etc/init.d/cron start

Let's see if it also helps for crontabs created by jailed users...

***DEDIT***
This is no solution...It doesn't work for me.

We really want to make crontabs/jovs available for jailed users. Does anyone know a solution?
After some puzzling, any help is welcome!
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005

Last edited by Hans; 28th February 2008 at 17:24.
Reply With Quote
  #9  
Old 1st March 2008, 18:47
daveb daveb is offline
Senior Member
 
Join Date: Dec 2006
Location: St Louis Mo
Posts: 272
Thanks: 43
Thanked 41 Times in 37 Posts
 
Default

I am curious since cron is a daemon should we edit /etc/init.d/cron so that cron now knows the location within the jail.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab scripts don't exist? BrKessels Installation/Configuration 4 15th November 2006 09:37
crontab in detail sysconfig Suggest HOWTO 0 4th November 2006 10:38
Crontab issue, 2 questions jang Installation/Configuration 2 20th September 2006 19:39
Nothing in crontab punto Installation/Configuration 8 1st August 2006 00:01
crontab entries... zokahn General 2 23rd April 2006 10:55


All times are GMT +2. The time now is 07:52.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.