Crontab problem

Hi all,

Why my crontab -e from root user is not accessible? It came out some sort of random number, 309. And also for other user, crontab -l came out crontab: can't open your crontab file.

I'm grateful for any any help. thanks.

Is there any error printed in the syslog ?!

If so, what is that ?

Your editor is not set to vi please set to vi as below

EDITOR=vi
export EDITOR

then open the cronatb �e

Thanks for the reply,

I run EDITOR=vi; export EDITOR and the crontab -e is working.
I wan to ask is the changes permanent? i mean can the changes survive rebooting?

can you help me also on crontab for user other than root?
i get, crontab: can't open your crontab file.
I tried EDITOR=vi; export EDITOR also. but still getting same error.

To make the changes permanent,

  1. place export command in ".bashrc".
  2. Another way to change your default editor as
update-alternatives --set editor <PATHOFVI>

You can make the env variable persistence's across reboot by placing the entry in .profile of users. Which you can get in the users home directory.

In case of user if you are getting error as "can't open your crontab file" then it appears to me that user do not have access to cron his work. Please check the entry in /etc/cron.d/cron.deny in case its not there you can check the other file cron.allow. if entry are not then then you can place in entry in cron.allow or you can remove the entry from cron.deny

But my user is not in /etc/cron.d/cron.deny & i do not have cron.allow file.Any other way i can check?

If there is no user entry in /etc/cron.d/cron.deny then it should allow user to submit the job to cron utility

/etc/profile is more generic (works with sh, ksh, bash and possibly zsh) than .bashrc which is bash specific.
update-alternatives is Gnu/Linux specific

---------- Post updated at 17:21 ---------- Previous update was at 17:15 ----------

Are you sure you aren't running "crontab -l" instead of "crontab -e" ?

I found out that it is due to the new user does not have an existing cron job. I added a cron job in it and it is working fine already. :(:frowning: