1826044 Members
3237 Online
109690 Solutions
New Discussion

Re: crontab -e

 
SOLVED
Go to solution
Ron Irving
Trusted Contributor

crontab -e

Hi again all.

I have an issue with crontab -e. When I sudo that command, a text editor window pops up, and tells me "Unable to read from file (probably no read permission)."

However, crontab -l workds like a charm!!

Any ideas??

thx
Should have been an astronaut.
5 REPLIES 5
smatador
Honored Contributor

Re: crontab -e

Matti_Kurkela
Honored Contributor

Re: crontab -e

"crontab -e" makes a temporary copy of your crontab to /var/tmp, and then starts $EDITOR to edit the copy. After the editor process completes, the "crontab -e" command replaces your existing crontab with a modified copy.

The fact that "crontab -l" works suggests that the problem might be with the creation of the temporary file, or accessing it.

Is your /var filesystem (or /var/tmp, if you've made it a separate filesystem) perhaps 100% full?

The name of the temporary file created by "crontab -e" is dynamically generated: something like /var/tmp/aaaa01539. I guess it might be created by the tmpnam() library function

I think there used to be a bug of some sort that caused similarly-named temporary files (not necessarily created by the crontab command, but something else that uses tmpnam()) to accumulate in /var/tmp. If there are a *lot* of old temporary files in /var/tmp, the tmpnam() algorithm may be unable to find an unused filename.

MK
MK
Ron Irving
Trusted Contributor

Re: crontab -e

I checked the cron.allow, and root is in there. Might the fact that I am 'sudo'ing in affect it? Should I put my own username in? This is not a problem on our other servers.

/var is at 67% full, so I don't thing that's an issue either.

Regards,

ron
Should have been an astronaut.
Victor Fridyev
Honored Contributor
Solution

Re: crontab -e

Why do you use sudo ? Root has full right to update crontab without any sudo.
But if you prefer sudo in any case, add ALL to root commands in /etc/sudoers.

HTH
Entities are not to be multiplied beyond necessity - RTFM
himacs
Super Advisor

Re: crontab -e

Hi Ron,


Can you try with below steps..

Just export the EDITOR with vi

EDITOR=vi
export EDITOR

Regards
himacs