Jump to content

apache user cannot execute useradd via sudo :(


Recommended Posts

Hi all

My server is centos 5.1 with php 5.1.6.

In my app I want apache to add user through sudo.

 

My sudoers file is:

%apache  ALL=(ALL) NOPASSWD: ALL

%tony  ALL=(ALL) NOPASSWD: ALL

 

My test.php í:

<?php

$username="hixhix";

system("/usr/bin/sudo /usr/sbin/useradd -s /sbin/nologin -M $username",$returnvalue);

echo "return value: $returnvalue";

However, user 'hixhix' not created by apache at all, it always returned 1.

how can I make my apache tu add user using sudo?

Please help me. I need your help.

Thanks and regards.

 

 

>Check your existing users, the user isn't apache it's iirc wwwrun.

Are you sure it is wwwrun, not apache in centos?

AFAIK, the user is wwwrun in SUSE, apache in centos/redhat and www-data in debian/ubuntu.

anyway I added wwwrun  ALL=(ALL) NOPASSWD: ALL into /etc/sudoers but still not works.

any idea?

thanks and regards

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.