in reply to helping in CGI script that add users to system

Congratulations! You've re-implemented getpwent and friends in a way that probably won't handle shadow passwords, or when things are retrieved via NIS or LDAP.

If you're going to reinvent wheels you might as well at least look at other existing wheels and how they handle this stuff.

  • Comment on Re: helping in CGI script that add users to system

Replies are listed 'Best First'.
Re^2: helping in CGI script that add users to system
by adam_blackice (Acolyte) on Apr 11, 2007 at 21:40 UTC
    thanx for your replay ....
    but iam asking about how ?!
    i mean how i can think about that
    it can done by passing the values of the new user to the file by write to it .....
    or iam using some of functions like getpwent ? .....
    please i want more detailed answer
      i mean how i can think about that

      It was all thought previously, and Fletch already gave you a link to follow.

      Get a copy of webmin and see how that software does the task you describe; all the details are there.

      The procedures to add or delete users from the system differ greatly with the underlying OS and the specific configuration of the host on which to perform these tasks. As Fletch wrote, there are different schemes: passwd and shadow files, LDAP, NIS, NIS+, PAM, differing system utilities that take care of user's home directories, skeleton files used to set up acounts and so on.

      If you want to write your own CGI to handle all that, go ahead, but look at webmin as a reference and starting point. Be aware that any process which modifies security tokens must run under UID 0, i.e. as root, which generally isn't the case with apache, so you need suexec...

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}