Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Cannot edit user level crontab

  1. #1
    Join Date
    Dec 2010
    Beans
    10

    Cannot edit user level crontab

    I use an Ubuntu server (2.6.27-7-server) to host a time and expense system for my company and I wanted to set up a cron job to automatically backup the time system and save the backup files to an external harddrive that is mounted via USB. However, I've been having what I believe to be a permissions problem when trying to add the cron job to crontab.

    For examples sake lets say my username is 'user'.

    When I am logged in as 'user' and I run crontab -l it shows me what is currently in crontab:

    user@ubuntu:~/jtime/jtime/backups$ crontab -l
    1,11,21,31,41,51 * * * * /home/user/jtime/jtime/pi/bin/wtjob # Journyx Timesheet maintenance

    I want to add another line to the crontab that looks like this:

    00 00 * * * /home/user/backup_timesheets.ksh # Journyx Timesheets Backup

    So the first clue that something isn't working right is that when I run crontab -e it shows me an empty file rather than what it shows me when I run crontab -l. Then, if I try adding my new entry to the empty file that crontab -e shows me I get the following error:

    [ Error writing /tmp/crontab.aLq1HX/crontab: Permission denied ]

    If I look at the permissions on the temp file that was created I see this:

    drwx------ 2 root user 4096 2010-12-31 10:50 crontab.aLq1HX

    My tmp directory is setup to be globally writable:

    ls -ltr tmp

    drwxrwxrwt 6 root root 12288 2010-12-31 10:51 tmp

    There also is no cron.allow or cron.deny files in my /etc directory so I don't think that's the probelm...especially since I can run crontab -l with no problems.

    Anyway, any help would be greatly appreciated. I've tried searching the forums and google in general and can't seem to come up with a solution to this problem.

    Thanks in advance,

    Josh

  2. #2
    Join Date
    Oct 2006
    Beans
    617
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Cannot edit user level crontab

    Did you read this https://help.ubuntu.com/community/CronHowto

    In Ubuntu, by default, there is not cron.allow and cron.deny, all users have permissions to create cron jobs. Read the link above and if the problem persists, you can create a cron.allow file and put ur username in it, hopefully that will fix it
    Registered Linux user # 0x6D9B1

  3. #3
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cannot edit user level crontab

    Quote Originally Posted by joshhowen View Post
    I use an Ubuntu server (2.6.27-7-server) to host a time and expense system for my company and I wanted to set up a cron job to automatically backup the time system and save the backup files to an external harddrive that is mounted via USB. However, I've been having what I believe to be a permissions problem when trying to add the cron job to crontab.

    For examples sake lets say my username is 'user'.

    When I am logged in as 'user' and I run crontab -l it shows me what is currently in crontab:

    user@ubuntu:~/jtime/jtime/backups$ crontab -l
    1,11,21,31,41,51 * * * * /home/user/jtime/jtime/pi/bin/wtjob # Journyx Timesheet maintenance

    I want to add another line to the crontab that looks like this:

    00 00 * * * /home/user/backup_timesheets.ksh # Journyx Timesheets Backup

    So the first clue that something isn't working right is that when I run crontab -e it shows me an empty file rather than what it shows me when I run crontab -l. Then, if I try adding my new entry to the empty file that crontab -e shows me I get the following error:

    [ Error writing /tmp/crontab.aLq1HX/crontab: Permission denied ]
    .........
    1. "2.6.27-7-server" is a kernel, not a Ubuntu version. Find out what version is installed and if it is up to date with all updates.
    2. What version of crontab is being used?
    Last edited by dcstar; January 1st, 2011 at 01:31 AM.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  4. #4
    Join Date
    Dec 2010
    Beans
    10

    Re: Cannot edit user level crontab

    nitro_n2o - Yes I had read that already. That's why I was saying that cron.allow and cron.deny didn't exist. On Ubuntu the default is to allow all uses to use cron right? I did try creating cron.allow and that didn't help though.

    dcstar - Forgive my lack of knowledge but how do I find out what version of crontab I have installed? I don't see an option for a version flag.

    Thanks for the help guys...

  5. #5
    Join Date
    Dec 2010
    Beans
    10

    Re: Cannot edit user level crontab

    By the way...the version of Ubuntu I am running is Ubuntu 8.10

  6. #6
    Join Date
    Jan 2008
    Location
    London, UK
    Beans
    474
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Cannot edit user level crontab

    you could try deleting the crontab and starting a new one crontab -r

  7. #7
    Join Date
    Dec 2010
    Beans
    10

    Re: Cannot edit user level crontab

    I just tried that (crontab -r) with the same results. It did delete the current crontab but I still can't create a new one due to the same permissions error.

    It seems to me like the root of the issue is that I can't write to the temporary files it is creating in my /tmp directory, even though the /tmp directory is globally writable. I could easily be way off on that though...

  8. #8
    Join Date
    Feb 2010
    Location
    Silicon Valley
    Beans
    1,898
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Cannot edit user level crontab

    The owner and group of your temp directory do not look right to me. If you invoke "crontab -e" as a normal user (gmargo in this example), the permissions, owner, group should look like:
    Code:
    $ ls -ld /tmp/crontab.*
    drwx------ 2 gmargo crontab 4096 Jan  3 08:56 /tmp/crontab.1E3N8g
    Which makes me wonder if the permissions on your crontab(1) executable are correct. They should look like this:
    Code:
    $ ls -l $(which crontab)
    -rwxr-sr-x 1 root crontab 35896 Aug 24 13:45 /usr/bin/crontab
    The above info is from 10.10 Maverick, but I verified on an old 8.10 Intrepid VM that the permissions, owner, group are the same.
    Note carefully that the executable is set-gid and not set-uid.
    Last edited by gmargo; January 3rd, 2011 at 06:14 PM. Reason: intrepid

  9. #9
    Join Date
    Dec 2010
    Beans
    10

    Re: Cannot edit user level crontab

    gmargo - The could easily be the problem if that's what the crontab executable permissions need to look like. Currently, they look like this:


    Code:
    ls -l $(which crontab)
    -rwsr-xr-x 1 root crontab 31632 2009-05-12 17:46 /usr/bin/crontab

  10. #10
    Join Date
    Dec 2010
    Beans
    10

    Re: Cannot edit user level crontab

    Should I change them to match what you have listed?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •