From owner-freebsd-stable@FreeBSD.ORG Fri Sep 27 09:18:43 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 718EC1FF for ; Fri, 27 Sep 2013 09:18:43 +0000 (UTC) (envelope-from amdmiek@gmail.com) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 104852DA7 for ; Fri, 27 Sep 2013 09:18:42 +0000 (UTC) Received: by mail-wg0-f51.google.com with SMTP id c11so2345065wgh.6 for ; Fri, 27 Sep 2013 02:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=P6b9G7lGVnWi0UpELSUaAP/i+HUnE3es5dXdvZOwsnM=; b=MuYDSg1vown4Si4Zl5ZzcR2Gn0d8nmPUg+16Pj4cotWQ3wn6VKt2LrjhKOCxRndmWI 61Iqp1uVVNome39Rtcq2zgKkjKCU2NC1gtfNw2Ek8ETAncA5EfgxZ/d1uDlR+zKsIZ+A iBpvjFeesG6xRnLvh07g98hQZJmYUbt/rryiw5dxbJgw7+TTsER8PEVnVDAhNjL7finq 0L/CrnWzOy67EFigNbMxTPcEq0PAANsG/r3x1h+OXz2MWT8+QPpv/pylR/iIBL7rUAtl t2pS3rGNtneIChaxwNdpsa9m2yuFUYjrIk+8Qbclu4tawSDp3f6FirX2WUSAMaymYtV/ q9DQ== MIME-Version: 1.0 X-Received: by 10.194.170.133 with SMTP id am5mr1060493wjc.42.1380273520914; Fri, 27 Sep 2013 02:18:40 -0700 (PDT) Received: by 10.180.208.43 with HTTP; Fri, 27 Sep 2013 02:18:40 -0700 (PDT) Date: Fri, 27 Sep 2013 13:18:40 +0400 Message-ID: Subject: Running a script via PHP From: Michael BlackHeart To: freebsd-stable Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2013 09:18:43 -0000 Hello there, It's quite off-topic, but I'm using freebsd-stable,so The priblem is - running a script that requires root privileges via PHP (or probably CGI - I do not care, just want it to be secure and working). It's all about minidlna service (I use upnp to so mediatomb and other are no options). On FreeBSD it should be resync-ed manually, so I've got a simple script placed in /etc/periodic/daily: more 957.dlna_update #!/bin/sh #Script to daily update minidlna DB a=3D"$*" if (/usr/local/etc/rc.d/minidlna stop 1>/dev/null);then sleep 10 if /usr/local/etc/rc.d/minidlna rescan;then /usr/bin/logger -t minidlna "DB updated." exit 0 else /usr/bin/logger -t minidlna "Error. Failed to update DB." exit 1 fi else /usr/bin/logger -t minidlna "Error. Failed to update DB." exit 1 fi And it's working fine to me. But it uses service infrastructure. So when I'm trying to run via PHP it fails. For example running under unprivileged user: id uid=3D1001(amd_miek) gid=3D0(wheel) groups=3D0(wheel),5(operator) -rwsr-sr-x 1 root wheel 394 27 =D3=C5=CE 10:58 957.dlna_update* sh -x 957.dlna_update + a=3D'' + /usr/local/etc/rc.d/minidlna stop kill: 10786: Operation not permitted + /usr/bin/logger -t minidlna 'Error. Failed to update DB.' + exit 1 What is the best way to run it via WEB?