Wang Tuma
Wang Tuma

Reputation: 1085

Where is user's cron job stored after "crontab -e"?

I'm root, and I saw there are a lot of contents in /etc/crontab, which I thought is the root's cron job configurations. When I use crontab -e, I saw nothing in the editor; after I quit crontab -e, what I added was not found in /etc/crontab. So, where is root's cron job configuration stored? And other users?

Upvotes: 23

Views: 22965

Answers (3)

oucil
oucil

Reputation: 4584

For those looking for Fedora/CentOS/RHES, it's:

/var/spool/cron/<username>

Upvotes: 6

fedorqui
fedorqui

Reputation: 289825

It is stored in the directory:

/var/spool/cron/crontabs

Containing one file per user.

From man crontab (at least on my Ubuntu 13):

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.

Upvotes: 31

peterh
peterh

Reputation: 1

It is distribution-dependant, but mostly it is in /var/spool/crontab/<username>.

Upvotes: 12

Related Questions