Samba Denying Apache to execute its Commands

Hi ,

I am trying to execute some commands through Apache Which are samba commands like cl-useradd -c " " -g -G samba
It works fine if its executed through root, But when executed through apache it has an error saying “Admin password for the service samba could not be found”.

I have many possibilities but couldn’t just make it, Can you please help me to execute samba commands through Apache.

Regards,
Pranav.

vi /etc/sudoers

Added

%apache ALL=NOPASSWD:/usr/bin/cl-useradd

Hi Alex

I have tried this in sudoers file. Still i am having the same error
“Admin password for the service samba could not be found”
When running through apache
Actually by adding this line it allows apache to execute sudo commands, but samba asks for admin password.

Please help

Regards,
Pranav

Use for apache:

sudo cl-useradd user samba

Hi Alex

I have tried all this, Actually the problem is Apache has got rights to execute sudo commands but Samba is denying the samba commands to execute and Says " Admin password for samba could not be found".
Is there any way around to actually make apache one of the admin users and doesn’t asks for a password whenever apache tries to execute samba commands like cl-useradd user samba
I can execute other commands like whoami,mv and other but not samba commands…~~! Hope this make my problem clear.

Regards,
Pranav

Hi

Is there any solution to my problem.

You can test the same at your system also
Try to run any samba command like cl-useradd … samba. from apache user. for that you need to do some changes to /etc/passwd
by giving apache a bash login apache x:81:81 /var/www /bin/bash

apache$cl-useradd … samba will give error : - “Admin password for the service samba could not be found”

There is enough rights to apache to run other sudo privilege based commands. But Samba commands are giving errors
Please help me in giving Apache enough rights to be able to run Samba commands.

Regards,
Pranav

vi /etc/sudoers

Added

%apache ALL=NOPASSWD:/usr/bin/cl-useradd

Insert the apache script

sudo cl-useradd user samba