Re: how create system users with php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Umar Draz wrote:
>   i want a script that i can add system user through
> php. For example i
> have FreeBSD 5.3 for adding a user in freebsd i use
> this command
>
> pw useradd username -g groupname -d /home/username -m
>
> now i want creating user through php what kind of
> script will be
> required

You *do* understand that this opens up a giant hole in your armour against
bad people, right?

And that you've got to be VERY careful about who can access this script,
and how they access it, and what it can do, right?

First, if this is a shared server, then you REALLY shouldn't do this,
because then *ANY* user can write a PHP script to create a new
username/password.  Bad Idea.

You'll first need to test a 'sudo' script that allows the PHP user to
execute that command.

You'll want that script executable *ONLY* by the PHP user, not the whole
world.

Some things to consider:

Make it a two-stage process, where a script just puts the names and
encrypted passwords in a database.

Then, a human reviews the list of new users to make sure they all match up
with, say, paid accounts, and approves the list.

Then, you have to find a way to insert the user with encrypted pass to
your system instead of havine the system re-encrypt the encrypted
password.

But that's safer than just blindly adding users because somebody managed
to run a PHP script.  [shudder]

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux