?
Solved

How to add new system user with perl cgi?

Posted on 2000-03-21
5
Medium Priority
?
152 Views
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!
Thanks
0
Comment
Question by:fatworm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Accepted Solution

by:
alien_life_form earned 80 total points
ID: 2643863
Greetings.

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.

Cheers,
    alf
0
 
LVL 6

Expert Comment

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

http://www.webmin.com/webmin/

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

0
 

Expert Comment

by:hakimus
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 (hakimus@usa.net)
and_wait_for_program.code
}
Cheers!
0
 

Expert Comment

by:hakimus
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 (hakimus@usa.net)
and_wait_for_program.code
}
Cheers!
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2645035
fatworm,

can you pl attach your PERL code??

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans

752 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