[Bug 1081379] [NEW] cron ignoring PATH from crontab

Cory Dodt launchpad at s.goonmill.org
Wed Nov 21 01:04:32 UTC 2012


Public bug reported:

cron 3.0pl1-120ubuntu4 appears to be ignoring the environment variables
in /etc/crontab, or at least PATH.

Per crontab(5) man page:

       Several environment variables are set up automatically by the cron(8) daemon.  SHELL is set to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner.  PATH  is
       set to "/usr/bin:/bin".  HOME, SHELL, and PATH may be overridden by settings in the crontab; LOGNAME is the user that the job is running from, and may not be changed.

I did the following simple test to demonstrate that /usr/bin:/bin is
being used as the PATH, and it is not being overriden as described. I'm
using the system default /etc/crontab contents. I added a cron entry
that just writes the output of "env".

cdodt 2 ~% cat /etc/crontab
[. . .]
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
[. . .]


root at blueprint:~# crontab -l
* * * * * env > ~/cronenv


root at blueprint:~# cat cronenv 
HOME=/root
LOGNAME=root
PATH=/usr/bin:/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/root


PATH, set from /etc/crontab, is not being used. Am I missing something?

** Affects: cron (Ubuntu)
     Importance: Undecided
         Status: New

** Package changed: php5 (Ubuntu) => cron (Ubuntu)

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in Ubuntu.
https://bugs.launchpad.net/bugs/1081379

Title:
  cron ignoring PATH from crontab

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cron/+bug/1081379/+subscriptions



More information about the Ubuntu-server-bugs mailing list