How to add new system user with perl cgi?

Posted on 2000-03-21
Last Modified: 2010-03-05
I want to build a new system user with perl cgi,I use the
command like this:
$a=system "/usr/sbin/useradd $username";
But after the program is run,$a got a "256" error.How can I do?
Please help me!
Question by:fatworm

Accepted Solution

alien_life_form earned 20 total points
ID: 2643863

You want to add a new system user with *CGI*?

First caveat:
Don't. If your box is Linux as it seems you can enable linuxconf web access, fire your browser on port 98 (I think) and get a perfectly good - not to mention much safer - interface to creating users and many, many other system tasks.

But if you *must* go through a CGI, you should take note that your webserver is in all  likelyhood running as a non-privileged user (usually nobody). useradd will laugh sardonically at any attempt of the script to execute it. So you should make your script setuid root, which is a gaping security hole and a catastrophe in waiting.

If you're going to do it, you might as well do chmod +s /usr/sbin/useradd - which allows everybody and my cat to create  a user on the box, and keep the cgi in user space. Security will not be much worse - it will be close to 'worst' either way. And, BTW, I think that way you'll get a user with no password, which makes things even more interesting.


Expert Comment

by:christopher sagayam
ID: 2644043
For ALL your WEB BASED ADMINISTRATIVE needs just download the perl script  at

and you can open the source code and see what is in it ?


Expert Comment

ID: 2644413
Well, if you wan, you can to do someprogram in perl taht:
create the user in /etc/passwd, create the user directoyr, and so on :)

This is taht you wan?
If (answer=yes) {
emailto (

Expert Comment

ID: 2644414
Well, if you wan, you can to do someprogram in perl taht:
create the user in /etc/passwd, create the user directoyr, and so on :)

This is that you wan?
If (answer=yes) {
emailto (
LVL 16

Expert Comment

ID: 2645035

can you pl attach your PERL code??

that way we can give you an more accurate/exact answer.

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Check file date before getting folder path 1 74
iSeries PERL Scripts 7 159
Is it true to say that Python is successor of Perl? 7 177
Log File Creation with Header and Footer 17 96
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question