|
From: opc on 27 Jul 2008 00:02 Hi I try execute unsucesfull the next code from web page <?php $cmd1 = shell_exec ("sudo /sbin/service named stop"); echo "$cmd1"; ?> I need write a script execute some command, but try start or stop service like named, network this don't work I edit visudo and add the next lines User_Alias MYGROUP = apache, xyz Cmnd_Alias MYCOMMAND = /sbin/service %MYGROUP ALL = MYCOMMAND %MYGROUP ALL=(ALL) NOPASSWD: ALL But don't work. Suggest? Thanks ...
From: Micah Gersten on 26 Jul 2008 23:48 Generally, apache runs as www-data. What was the output of the command? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com I need write a script execute some command, but try start or stop service like named, network this don't work I edit visudo and add the next lines User_Alias MYGROUP = apache, xyz opc(a)orenses.com wrote: > Hi > > I try execute unsucesfull the next code from web page > > <?php > $cmd1 = shell_exec ("sudo /sbin/service named stop"); > echo "$cmd1"; > ?> > > I need write a script execute some command, but try start or stop service > like named, network this don't work > > I edit visudo and add the next lines > > User_Alias MYGROUP = apache, xyz > Cmnd_Alias MYCOMMAND = /sbin/service > %MYGROUP ALL = MYCOMMAND > %MYGROUP ALL=(ALL) NOPASSWD: ALL > > But don't work. > > Suggest? Thanks ... > >
From: "Daniel Brown" on 27 Jul 2008 11:02 On Sat, Jul 26, 2008 at 11:48 PM, Micah Gersten <micah(a)onshore.com> wrote: > Generally, apache runs as www-data. What was the output of the command? Actually, Apache generally runs (in order) as nobody, apache, httpd, or daemon. Some distros (such as Ubuntu) or control panel installations (such as Plesk) change this default. For example, Ubuntu Feisty uses 'www-data', and Plesk uses a group of 'psacln'. From PHP, if system access (i.e. - exec(), passthru(), etc.) is allowed, the easiest way to find out which user you are with Apache on *NIX is to run this file in a browser: <?php echo `whoami`; ?> -- </Daniel P. Brown> Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo.
|
Pages: 1 Prev: get current php locale Next: SOLUTION [Fwd: Start/Stop Service from program php] |