Re: How to add user to linux using php
| From: | J R | Date: | Tue, 05 Sep 2006 01:10:33 +0000 |
| Subject: | Re: How to add user to linux using php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241361@lists.php.net to get a copy of this message | ||
you have to understand that the adduser is a previledge command and a root
only command (unless you allowed other users) and normally php will and
should be running in a restricted access. normally it is running as user
apache/user/nobody (depends on your settings) now there are two ways you can
allow adduser(or any priviledge command for that matter).
1. give user apache the addusser priviledge (which is very unsecure), then
execute shell_exe as root would.
2. create a root process like a cron job which will start at boot of your
server, then on your shell_exe pass your command to that process and have
that root process execute that command (bit more secure).
hth,
john
On 9/5/06, Jon Anderson <jon@gamingsolutions.ca> wrote:
eqla3.com eqla3.com wrote: is there any way to add user and apply password by executing shell command through php? Depending on the distribution, you should have a user addition command that takes a password argument. In my case, useradd <other args> -p '<password>' <user>. Check the manual page for adduser , useradd or your distribution's variant. Worst case, you can even make a wrapper around the command with shell script that'll do the multiline echo for you. jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- GMail Rocks!!!