Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

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?

like image 406
Wang Tuma Avatar asked Mar 11 '14 10:03

Wang Tuma


2 Answers

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.

like image 196
fedorqui 'SO stop harming' Avatar answered Oct 23 '22 17:10

fedorqui 'SO stop harming'


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

like image 44
peterh Avatar answered Oct 23 '22 17:10

peterh