Score:0

crontab -e does not save the cron for current user

eg flag

I am using Ubuntu 20 under AWS Ec2 instance. I have created a custom user other than the default user ubuntu. When I try to edit the cron file by crontab -e it opens the from file and shows the previously added crons. I want to edit the time/frequency of cron job to be executed.

I changed the time and saved it by CTRL + o. It saved successfully without any error. But when I exit by CTRL + x I see there is an error:

/var/spool/cron/: mkstemp: Permission denied
crontab: edits left in /tmp/crontab.Zr6S9D/crontab

Actually long ago the command used to work and it was saving correctly. But after some period I don't know what happened to it.

When I edit the cron from root i.e. sudo crontab -e it opens and I can save anything in it. I don't want to execute cron from root because its creating too much file permission error time to time for a Magento Application

There are few things that I have tested.

  • Server has the much space available
  • Anything I edit in /var/spool/cron/crontabs/<user_name> is editable and I can save data in it when I open this in nano
  • I tried deleting content of /tmp folder. No success.

Thanks.

cn flag
sudo crontab -e does not use ROOT it uses your admin, crontab -e uses your current user, that does not have to be the admin. sudo -i && crontab -e uses root. "its creating too much file permission error time to time for a Magento Application" no it does not; you are likely doing something wong ;-) and if that is an issue for you: why are you not using /etc/crontab? That one you can tell for each line what user to use for the command. The better approach would be to use a systemd service.
eg flag
Can you suggest me the code. What should I use?
guiverc avatar
cn flag
Ubuntu 20? So this is a Ubuntu Core 20 server system? (Ubuntu uses *year.month* for *deb* based products & the *year* format for the *snap* only products; so 20 & 20.04 are different products)
eg flag
Sorry I didn't know about that. I used Ubuntu 20 as symbolic means.
guiverc avatar
cn flag
Ubuntu Core 20 & Ubuntu 20.04 LTS are different products, because of the *confinement* used in 20, added complications exist (even if 20 is built from the 20.04 base). Ubuntu Core 20 is quick to *spin* up in cloud environments so has advantages (*a smaller system as less complex than the 20.04 product*).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.