Date: Fri, 15 Jun 2007 16:48:30 -0700 From: Jeremy Chadwick <koitsu@FreeBSD.org> To: Daniel =?iso-8859-1?B?RHZvPz/haw==?= <dandee@hellteam.net> Cc: ports@FreeBSD.org Subject: Re: FreeBSD Port: ipfw2dshield-0.5 Message-ID: <20070615234830.GA89210@eos.sc1.parodius.com> In-Reply-To: <000701c7afa5$12355c20$6508280a@tocnet28.jspoj.czf> References: <001101c7af95$6bd7c840$6508280a@tocnet28.jspoj.czf> <4673076E.7040907@yahoo.com> <000001c7af99$0108cec0$6508280a@tocnet28.jspoj.czf> <20070615230347.GB88372@eos.sc1.parodius.com> <000701c7afa5$12355c20$6508280a@tocnet28.jspoj.czf>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 16, 2007 at 01:29:50AM +0200, Daniel Dvo??ák wrote: > -----Original Message----- > From: Jeremy Chadwick [mailto:koitsu@FreeBSD.org] > Sent: Saturday, June 16, 2007 1:04 AM > To: Daniel Dvo??ák > Cc: 'John Merryweather Cooper'; ports@FreeBSD.org; frank@dynamical-systems.org > Subject: Re: FreeBSD Port: ipfw2dshield-0.5 > > > FreeBSD by default sets PATH to what you see in the mail from cron. > > That is, /usr/local/bin is not include in the list. This is Normal(tm). > > Yes, I know and so I was surprised when cron showed this: > > X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin> > > which is not actualy true because this: > > X# setenv > TERM=cons25 > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin > MAIL=/var/mail/root Actually, it is true. I suppose no one's explained to you the difference between an interactive shell, a non-interactive shell, and a login shell. I guess I'll do that now. An interactive shell is one which allocates a pty; an easy way to remember this is "a shell you plan on typing (interactively) in". A non-interactive shell is a shell where there is no actual pty associated with the shell. A login shell is an interactive shell which is spawned from login(1). On FreeBSD, root's shell is /bin/csh. It's recommended you do not change it. Regardless, if you spawn an interactive (or login) shell (examples: logging in on the console, ssh'ing in as root, telnetting in as root, or logging in as yourself then using su/sudo/su2, etc.) /bin/csh will read will read /root/.cshrc. You'll find a "set path" in that file, which contains /usr/local/bin. This is why you see /usr/local/bin when you do a "setenv". The same concept applies to /bin/sh, except /bin/sh reads /etc/profile and /root/.profile on an interactive shell. You'll find that PATH is set inside of /root/.profile. Now let's talk about cron. cron, by default, uses a shell of /bin/sh. All the shells spawned from cron are non-interactive. Therefore, /root/.profile does not get read, thus the default PATH is used. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070615234830.GA89210>