Hi,
Cronie seems to ignore HOME for sending mail, which causes mailing of
the output to fail when the user's official homedir is not accessible.
This is a problem for remote homedirs which require authentication.
The problem can be reproduced as follows:
1. useradd --no-create-home testuser
2. cat <<EOF > crontab
HOME=/tmp
* * * * * echo "test"
EOF
3. crontab -u testuser crontab
On RHEL7 (cronie-1.4.11-13), no mail is send, and the log shows:
(testuser) CMD (echo "test")
(CRON) ERROR chdir failed (/home/testuser): No such file or directory
(testuser) MAIL (mailed 5 bytes of output but got status 0x0002
(Note: the trailing ')' is missing?)
The problem is caused by popen.c using pw->pw_dir when calling
cron_change_user_permanently, while do_command.c uses env_get("HOME",
jobenv) when calling cron_change_user_permanently. I don't know the
historic reasons for the difference, but shouldn't popen.c be using the
HOME setting too?
Robbert
--
Robbert Eggermont Intelligent Systems
R.Eggermont(a)tudelft.nl Electr.Eng., Mathematics & Comp.Science
+31 15 27 83234 Delft University of Technology