From owner-freebsd-questions@freebsd.org Wed Apr 27 07:22:02 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADC0DB1EE9A for ; Wed, 27 Apr 2016 07:22:02 +0000 (UTC) (envelope-from steve@sohara.org) Received: from uk1mail2513.mymailbank.co.uk (UK1MAIL2513-PERMANET.IE.mymailbank.co.uk [217.69.47.44]) by mx1.freebsd.org (Postfix) with ESMTP id 334131387 for ; Wed, 27 Apr 2016 07:22:01 +0000 (UTC) (envelope-from steve@sohara.org) Received: from smtp.lan.sohara.org (UnknownHost [88.151.27.41]) by uk1mail2513-d.mymailbank.co.uk with SMTP; Wed, 27 Apr 2016 08:21:35 +0100 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.86 (FreeBSD)) (envelope-from ) id 1avJn5-0001SS-Ge; Wed, 27 Apr 2016 07:21:43 +0000 Date: Wed, 27 Apr 2016 08:21:42 +0100 From: Steve O'Hara-Smith To: Niklaas Baudet von Gersdorff Cc: freebsd-questions@freebsd.org Subject: Re: Why is www's $PATH only /usr/bin:/bin? Message-Id: <20160427082142.fd56427e6b96fb6fb2b29035@sohara.org> In-Reply-To: <20160426194048.GA31481@box-fra-01.niklaas.eu> References: <20160426194048.GA31481@box-fra-01.niklaas.eu> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.29; amd64-portbld-freebsd10.1) X-Clacks-Overhead: "GNU Terry Pratchett" Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 07:22:02 -0000 On Tue, 26 Apr 2016 21:40:48 +0200 Niklaas Baudet von Gersdorff wrote: > Hi, > > I figured that www's $PATH is only /usr/bin:/bin. Why is that if > /etc/login.conf says the following? > > default:\ > --------8<-------- > :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin > ~/bin:\ > --------8<-------- I assume you mean this is the path available to CGI or similar running under a web server. If so then the reason for the discrepancy is at least in part that user www never logged in ... > /etc/passwd looks like this. > > www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin ... and indeed cannot log in so the login.conf is not going to apply. It is also possible (indeed likely) that the web server deliberately minimises the path passed to CGI scripts for security. > So, I left everything the default. > > The thing is that I want to run something in /usr/local/bin with PHP's > > shell_exec($cmd); > > but that's not working because it's not in $PATH. > > Any hint is very much appreciated. It should be possible to adjust the path seen by PHP in the PHP config. -- Steve O'Hara-Smith