Quantcast
Viewing all articles
Browse latest Browse all 18089

Re: Debian on Edison

Thanks, but that doesn't seem to change anything.  As a more concrete example of what I'm attempting to do, consider having Apache2 run a perl script that includes a command that generally requires root privileges, e.g.:

#!/usr/local/bin/perl

     use strict;

     use warnings;

 

     system("mount /dev/sda1 /usbdrive");

When run from the console (i.e. as 'root') the simple script above works fine.  However, it fails when Apache2 runs it, giving the error in /var/log/apache2/error.log:

.

.

mount: only root can do that

I fully expect that error, since Apache2 runs the script as user 'www-data'. So, to avoid that error, I add 'sudo' to the above perl script:

#!/usr/local/bin/perl

     use strict;

     use warnings;

 

     system("sudo mount /dev/sda1 /usbdrive");

 

My /etc/sudoers looks like this:

#

# This file MUST be edited with the 'visudo' command as root.

#

# Please consider adding local content in /etc/sudoers.d/ instead of

# directly modifying this file.

#

# See the man page for details on how to write a sudoers file.

#

Defaults    env_reset

Defaults    mail_badpass

Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

 

# Host alias specification

 

# User alias specification

 

# Cmnd alias specification

 

# User privilege specification

root    ALL=(ALL:ALL) ALL

www-data ALL=(ALL:ALL) ALL

 

# Allow members of group sudo to execute any command

%sudo    ALL=(ALL:ALL) ALL

 

# See sudoers(5) for more information on "#include" directives:

 

#includedir /etc/sudoers.d

 

 

Again, when I run the revised perl script from the console (i.e. as 'root') it works fine.  However, it still fails when Apache2 runs it, giving the error in /var/log/apache2/error.log:

.

.

sudo: effective uid is not 0, is sudo installed setuid root?

 

Any way to get past this?


Viewing all articles
Browse latest Browse all 18089

Trending Articles