Description of problem: When a user is running cron job, the crond process doesn't care the changes of the user's home directory. Except restarting the crond service or changing the user's crontab file. Version-Release number of selected component (if applicable): RHEL5.2 How reproducible: Reproduce every time. Steps to Reproduce: 1.Create a user with a non-exist home directory. #useradd -d /data/user1 user1 2.Add a cron job as user1 #su - user1 #crontab -e * * * * * /bin/echo hello The cron job will fail as the user doesn't own a home directory. 3.Modify the /etc/passwd to change the user's home directory. #cd /home/user1 #mkdir /home/user1 #chown user1 /home/user1 #vi /etc/passwd user1:x:501:501::/home/user1:/bin/bash the user1 still couldn't use the cron job. 4.Restart crond service or change the crontab file,the user1'cron job will work successfully. #service crond restart or $crontab -e * 2 * * * * /bin/echo hello Then the user1's cron job will work successfully. Actual results: It needs to restart crond service or change the crontab file manually so as to make crond process care it. Then the crond finds the user's home directory and it will work successfully. Expected results: Change a user's home directory, the crond will care it automatically. Additional info: I found a bugzilla that cron jobs for users without home doesn't work: https://bugzilla.redhat.com/show_bug.cgi?id=455379 This bug has been fixed with the vixie-cron-4.1-76 vesion. But it still not solves the problem that crond process ignores the changes of user's home directory except restarting crond service or changing the crontab file. We can see the error log: #tailf /var/log/cron Nov 19 15:20:01 dhcp-129-211 crond[24575]: (CRON) chdir(HOME) failed: (No such file or directory) Nov 19 15:20:01 dhcp-129-211 crond[24576]: (user6) CMD (/bin/echo hello)
The kbase article is https://access.redhat.com/kb/docs/DOC-42920
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
This request was erroneously denied for the current release of Red Hat Enterprise Linux. The error has been fixed and this request has been re-proposed for the current release.
This might be related to bug #455664. I'll do a testing with patch for orphaned crontabs.
useradd -d /data/alik alik su - alik [alik@rhel-5-marcela ~]$ crontab -e * * * * * touch /tmp/alik Sep 23 12:48:27 rhel-5-marcela crontab[8952]: (alik) BEGIN EDIT (alik) Sep 23 12:48:40 rhel-5-marcela crontab[8952]: (alik) REPLACE (alik) Sep 23 12:48:40 rhel-5-marcela crontab[8952]: (alik) END EDIT (alik) Sep 23 12:49:01 rhel-5-marcela crond[8962]: (alik) CMD (touch /tmp/alik) Let's change /data/alik to /home/alik in /etc/passwd. Sep 23 12:53:01 rhel-5-marcela crond[9117]: (alik) CMD (touch /tmp/alik) It looks like this bug was fixed by fixing orphans in bug #455664.
I didn't remove directories properly in my previous testing. The bug is still there and also the upstream version has the same problem. The fix would mean bigger code changes, which I don't dare trying in RHEL-5 first. I add this into upstream Todo list, but I'm closing it here.