Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 654961

Summary: crond process ignores the changes of user's home directory
Product: Red Hat Enterprise Linux 5 Reporter: wangshibo <jaswang>
Component: vixie-cronAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: azelinka, ovasik, psklenar
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-19 12:41:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description wangshibo 2010-11-19 07:24:34 UTC
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)

Comment 1 wangshibo 2010-11-19 07:40:00 UTC
The kbase article is https://access.redhat.com/kb/docs/DOC-42920

Comment 2 RHEL Program Management 2011-01-11 21:06:03 UTC
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.

Comment 3 RHEL Program Management 2011-01-12 15:18:29 UTC
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.

Comment 4 RHEL Program Management 2011-05-31 13:42:41 UTC
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.

Comment 5 Marcela Mašláňová 2011-09-14 11:40:57 UTC
This might be related to bug #455664. I'll do a testing with patch for orphaned crontabs.

Comment 6 Marcela Mašláňová 2011-09-23 10:56:17 UTC
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.

Comment 11 Marcela Mašláňová 2011-10-19 12:41:06 UTC
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.