1835220 Members
2341 Online
110078 Solutions
New Discussion

regarding crontab

 
SOLVED
Go to solution
Kiran_27
Advisor

regarding crontab

hi,
I am not able to edit my crontab file.
The user name is available in crontab.allow file and crontab.deny file is not there.
I am able to edit my user crontab when I login as as root using command crontab -e
But when I try editing it ( when I am logged in as user) I am getting error message as
crontab: can't create your crontab file in the crontab directory
I even changed permission of the directory and the crontab file ( giving full permission ) still it is showing the error.
Can you throw some light on this.......
9 REPLIES 9
Franky_1
Respected Contributor

Re: regarding crontab

Hi,

normally it should work when you've added the user in /usr/lib/cron/cron.allow
Maybe the rights of /var/tmp are not set to 777 so that would cause the problem

Set permission 777 for /var/tmp and it should work

Regards

Franky
Don't worry be happy
Bharat Katkar
Honored Contributor

Re: regarding crontab

Kiran,
try this one

First make sure "/usr/lib/cron/cron.allow" contains "user" and remove cron.deny

0. log in as root and remove that crontab file of user "user".
1. log in as user ( i will assume username as "user" )
2. Then $ crontab -e user
edit the file as per the requirement and then save.
3. See if you have valid entries in crontab by " $ crontab -l user "

This works.
Regards,


You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: regarding crontab

Hi while removing "user"'s crontab file :
login as root and then use:

# crontab -r user

Regards,
You need to know a lot to actually know how little you know
Elmar P. Kolkman
Honored Contributor
Solution

Re: regarding crontab

Make sure the setuid bit is still on your crontab command. Here the ls -l line looks like this:
-r-sr-xr-x 1 root bin 28672 Feb 18 1999 /usr/bin/crontab

The rights on the crontabs directory should be this:
dr-xr-xr-x 2 bin bin 1024 Aug 29 17:30 /var/spool/cron/crontabs

Good luck,

Elmar
Every problem has at least one solution. Only some solutions are harder to find.
Kiran_27
Advisor

Re: regarding crontab

hi ,
I had changed the rights of /var/tmp to 777 still its showing the error message
crontab: can't create your crontab file in the crontab directory.
When I manually copied that file from /var/tmp to crontab directory its getting coppied........
But when I edit the file using crontab -e is not getting copied.
Franky_1
Respected Contributor

Re: regarding crontab

Hi Kiran,

i don't think the problem lies in the cron.allow file because then another error (like: you're not authorized ...) would come up. But when i change my rights of /var/tmp to 755 the error mentioned by you (can't create ...) is coming up - when i change it back to 777 it works !

HTH

Franky
Don't worry be happy
Muthukumar_5
Honored Contributor

Re: regarding crontab

When ever you try to make cron entry as,

$ crontab -e
entries

It will copy the contents to /var/tmp/*** file. And then it copy it to /var/spool/cron/crontab/

The permission will be as root:

If you don't have 777 permission on /var/tmp/ directory then it will be a problem.

Else change the problem as,

$echo "your cron entry" > cronfile

crontab cronfile

It will upload it on crontabs directory now.
can you do it without any problem now.

Check points:

Are you getting added entries when,
crontab -l

Edit the cron informations now as,
cron -e




Easy to suggest when don't know about the problem!
Kiran_27
Advisor

Re: regarding crontab

hi muthukumar,
When I try copying the file to my crontab ,
i.e crontab
I am getting the following error
crontab: error in message queue open, errno=13
What is this error? how do I correct it??

Regards
kiran
Kiran_27
Advisor

Re: regarding crontab

Hi all,
Thanx for you support.
I could solve it by changing the permission of /usr/bin/crontab binary( chmod u=rs,go=rx,o=rx) and the /var/spool/cron/crontabs ( chmod u=rx,go=rx,o=rx)
Regards
Kiran