Server Fault is a question and answer site for system and network administrators. 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

After removing the user, does the crontab added by that user gets removed as well? I am asking this because I can see a user file called "abcuser" in the


When I cat the file, I can see the crons added by that user. The user no longer exist and the cron's won't work. But why does the crontab file is still there?

share|improve this question
up vote 8 down vote accepted

By default, userdel doesn't remove the user's cron, at, and print jobs. To do it, uncomment the following line in /etc/login.defs:

USERDEL_CMD /usr/sbin/userdel_local 

Here is an example of userdel_local script:

#! /bin/sh

if [ $# != 1 ]; then
    echo "Usage: $0 username"
    exit 1

crontab -r -u $1

So, whenever you execute userdel, any cron jobs owned by the user will be remove.

share|improve this answer
+1 for that. I learned something this morning; thanks, quanta! – MadHatter Oct 3 '11 at 7:27

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.