herbertandperl has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: (OT) user creation with perl
by Anonymous Monk on Sep 26, 2005 at 11:22 UTC
    You can't create a new user without having root-permissions. You have to be root (or use sudo), then you can use the adduser command.
Re: (OT) user creation with perl
by jbrugger (Parson) on Sep 26, 2005 at 12:14 UTC
    If you want to do this in Perl, i'd suggest you install Webmin on the linux-box (as root), yes it's written in Perl, and create user accounts in it, with the privileges you need.
    From within Webmin, you have a clean simple userinterface for maintaining your linux box, without the need of understanding the command-line.
    I do not recommend this way of working by the way, a clear understanding of what you're doing is important in this case, and i don't know how secure Webmin is.

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: (OT) user creation with perl
by blazar (Canon) on Sep 26, 2005 at 11:44 UTC
    Dear Friends, I need a Help. how can i create a new user in linux from a already exist user account ( not ROOT user ). ie. using setuid() function i have to activate the user as root user tempararyly and create one user. and also change the file permission ( to write ) which is also created by root user.
    Foggy question, IMHO. And -as stated- deserving an answer along the lines of "you can't". Also, still IMHO, if you have to ask you don't want to mess w/ this kinda stuff, believe me.
    its urgent please help me.
    Generally this doesn't buy you anything. Good of you not to have put that into the Subject.
Re: (OT) user creation with perl
by graff (Chancellor) on Sep 26, 2005 at 12:34 UTC
    If you really think you want to create an easy-to-use perl script that allows anyone with a user account on a linux box to create a new user account on that box, then either you yourself are a cracker, or else you are (knowingly or not) a cracker's "best friend", i.e. a person who disables a basic and essential security feature.

    What you're suggesting is sort of like leaving the key in the lock when you walk away from your house or car. Having an "urgent" need to do so is ridiculous.

Re: (OT) user creation with perl
by Anonymous Monk on Sep 26, 2005 at 13:13 UTC
    In generally, in Unix you cannot add users without being root, although some Unices have suid programs that allow non-root users to add users. IIRC, Solaris allows anyone in the admin group to add users using admintool. But still, those tools work by temporarely giving someone root powers - and only root can grant those powers.