LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Creating a linux user through php (https://www.linuxquestions.org/questions/programming-9/creating-a-linux-user-through-php-220071/)

taqs 08-20-2004 05:37 AM

Creating a linux user through php
 
Hi All,
i want to create linux user, set his password and create a mailbox for the created user. I am trying exec method to execute the useradd command but no luck.
Any help is highly appreciated.

demoncheese 08-20-2004 05:47 AM

You should be able to use exec or the backtick to execute commands to do that but you will need to make sure that safe_mode is off to let you do that - by default it will be on.

taqs 08-23-2004 06:05 AM

Need things to be more explained
 
I 've been trying to find a solutions for this problem. Some articles suggest that i will have to run apache process as a root user to execute exec command. Or as you said i will have to turn the safe mode off.
But i have not been able to find how to perform these tasks.
Can you please tell me some link where this process is explained ?

Cedrik 08-23-2004 12:42 PM

just change the User and Group directives in httpd.conf to root value for both, but after that you shouldn't run this server over the internet.

taqs 08-24-2004 05:55 AM

HTTPD Fails if i set root value for user and group attributes
 
Hi,
If i change user and group attribute values to root. HTTPD service fails.
i really am stuck with it.
Please help.

demoncheese 08-24-2004 06:30 AM

You shouldn't need to run Apache as root to do this as my webmin install can do it fine and Apache is not running as root on my machine.

The best way round it is probably to download and have a look at the way webmin (www.webmin.com) implements adding a new user. You should be able to su and then add the user using either the exec command in php iteself or using it to run a bash script to create the user.

To run exec though you should will need to make sure that PHP is not running in safe mode, You should be able to turn it off by editing the line in the php.ini file from 'safe_mode = On' to 'safe_mode = Off' and restarting the server.

As Cedrik said though, I wouldn't allow the server access from the internet.

Cedrik 08-24-2004 12:29 PM

from the webmin site :

Webmin consists of a simple web server, and a number of CGI programs which directly update system files like /etc/inetd.conf and /etc/passwd. The web server and all CGI programs are written in Perl version 5, and use no non-standard Perl modules.

Webmin is not an apache web server, it is a standalone web server and it is run as root to be able to change settings like DNS config, Lilo/Grub config etc...


All times are GMT -5. The time now is 03:31 AM.