Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my Ubuntu, my username is "meuser". When i do crontab -e, i can setup my rules. But instead of doing it with crontab -e, how can i do it directly to a file? Which file i cant modify?

share|improve this question
up vote 6 down vote accepted

Quoting crontab's man page:

There is one file for each user's crontab under the /var/spool/cron/crontabs directory. Users are not allowed to edit the files under that directory directly to ensure that only users allowed by the system to run periodic tasks can add them, and only syntactically correct crontabs will be written there. This is enforced by having the directory writable only by the crontab group and configuring crontab command with the setgid bid set for that specific group.

So you can't directly edit this file in a script (without sudoing around the restrictions). But, what you can do is the following: Just create a crontab file somewhere in the filesystem and then use

crontab <filename>

to install it.

share|improve this answer

You need to type in sudo crontab -e in the command line. The in the editor that pops open, hit the i key to insert in the cron that you want to add. I had to do this for my installation on and it worked great running it from my ubuntu server instance on amazon ec2.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.