Solved

How to add new system user with perl cgi?

Posted on 2000-03-21
5
144 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
5 Comments
 
LVL 3

Accepted Solution

by:
alien_life_form earned 20 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now