From owner-freebsd-questions@freebsd.org Tue Apr 26 21:16:04 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 BC460B1D5F3 for ; Tue, 26 Apr 2016 21:16:04 +0000 (UTC) (envelope-from galtsev@kicp.uchicago.edu) Received: from cosmo.uchicago.edu (cosmo.uchicago.edu [128.135.70.90]) by mx1.freebsd.org (Postfix) with ESMTP id 8E9501E5C for ; Tue, 26 Apr 2016 21:16:04 +0000 (UTC) (envelope-from galtsev@kicp.uchicago.edu) Received: by cosmo.uchicago.edu (Postfix, from userid 48) id B1ED9CB8CA4; Tue, 26 Apr 2016 16:15:58 -0500 (CDT) Received: from 128.135.52.6 (SquirrelMail authenticated user valeri) by cosmo.uchicago.edu with HTTP; Tue, 26 Apr 2016 16:15:58 -0500 (CDT) Message-ID: <46778.128.135.52.6.1461705358.squirrel@cosmo.uchicago.edu> In-Reply-To: <20160426194048.GA31481@box-fra-01.niklaas.eu> References: <20160426194048.GA31481@box-fra-01.niklaas.eu> Date: Tue, 26 Apr 2016 16:15:58 -0500 (CDT) Subject: Re: Why is www's $PATH only /usr/bin:/bin? From: "Valeri Galtsev" To: freebsd-questions@freebsd.org Reply-To: galtsev@kicp.uchicago.edu User-Agent: SquirrelMail/1.4.8-5.el5.centos.7 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: Tue, 26 Apr 2016 21:16:04 -0000 On Tue, April 26, 2016 2:40 pm, 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<-------- > > /etc/passwd looks like this. > > www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin > > 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. You can have $cmd containing full absolute path to the command bewith leading slash, say: /usr/local/bin/yourcommand then it should work (unless daemon runs chrooted, then you need to have copied of all these in chrooted environment). Having daemons exposed to external world able access as minimum of things as necessary would be a good security practice. Valeri > > Any hint is very much appreciated. > > Niklaas > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" > ++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++