• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: cron for regular user ?  (Read 2571 times)
Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« on: August 17, 2009, 02:52:51 PM »

Hi, I want to use crontab from a user that isn't root. But it doesn't work:

Quote
heryro@debian:/etc/cron.d$ crontab -e
/var/spool/cron/crontabs/heryro: Permission denied

So I created a /etc/cron.allow and added my username in the first line. Unfortunately this didn't work.
How do I give a non-root-user cron?
Logged

dattaway
Jr. Member
**

Karma: 5
Posts: 91



View Profile WWW
« Reply #1 on: August 18, 2009, 09:34:25 AM »

You might have to set yourself in the crontab group.

usermod -g crontab you
Logged

Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #2 on: August 20, 2009, 12:17:45 PM »

Added the user to the groups "crontab" and "adm", unfortunately the same error keeps coming up.
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #3 on: August 20, 2009, 12:56:42 PM »

You shouldn't need to be a member of the crontab group to have a personal crontab.  It looks like you are still on the original Linux that came with the Plug.  If so, be aware that many (all?) of the setuid/setgid programs in that load did not have their SUID/SGID bits set correctly.  For instance /bin/su was not SUID root, so you could not "su" as a regular user.

I suspect the /usr/bin/crontab permissions are similarly incorrectly set.  Here's what they should look like:

-rwxr-sr-x 1 root crontab 27492 2009-05-12 17:55 /usr/bin/crontab

(The size and date will differ on your load.)

If your /usr/bin/crontab does not have "crontab" as its group, and does not have the SGID bit set (the 's' in "-rwxr-sr-x") that is your problem.  You can fix this by "# chgrp crontab /usr/bin/crontab; chmod g+s /usr/bin/crontab".  But, I think you'll find this is the tip of the iceberg.  FWIW, the alpha-6 root fs seems to be correctly configured.

YMMV.
Logged

Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #4 on: August 20, 2009, 01:25:02 PM »

I tried this "chgrp crontab /usr/bin/crontab; chmod g+s /usr/bin/crontab" and now have this:

Code:
-rwxr-sr-x 1 root crontab 27496 Nov 16  2008 /usr/bin/crontab

But the same error remains. Should I install the alpha 6 ?
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #5 on: August 20, 2009, 01:51:10 PM »

I can attest to the fact that crontabs work under the alpha-6 load, as well as some other things that are broken under the load that comes with the Plug.

If you want to continue diagnosing your problem, I'd suggest looking at  /var/spool/cron/crontabs/:  Does this directory exist?  Are the permission and owner/group correctly set?   Here's what it should look like:

Code:
# ls -ld /var/spool/cron /var/spool/cron/crontabs
drwxr-xr-x 5 root root    4096 Jul 10 21:06 /var/spool/cron
drwx-wx--T 2 root crontab 4096 Nov 16  2008 /var/spool/cron/crontabs

(I recall that there was a section of /var that was overlayed by a ramdisk, and needed to be recreated on every boot in your load.  This might be the problem.)
Logged

Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #6 on: August 21, 2009, 02:09:00 AM »

Code:
heryro@debian:/$ ls -ld /var/spool/cron /var/spool/crontabs
ls: cannot access /var/spool/crontabs: No such file or directory
drwxr-xr-x 3 root root 4096 Nov 16  2008 /var/spool/cron

When I use "sudo crontab -u heryro -e" another entry appears in /var/spool/cron/. But after a reboot it dissapears like you said. Would the alpha 6 be an easy fix?
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #7 on: August 21, 2009, 01:39:19 PM »

Yes.
Logged

Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #8 on: August 23, 2009, 05:52:38 AM »

I made a mistake, "sudo crontab -u heryro -e" does work. Problem turned out to be the command I added in crontab.
Logged

Pages: [1]
Print
Jump to: