[Bug 1081379] Re: cron ignoring PATH from crontab

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


Additional info: /etc/environment contains this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

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

Title:
  cron ignoring PATH from crontab

Status in “cron” package in Ubuntu:
  New

Bug description:
  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?

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




More information about the foundations-bugs mailing list