Solved

How to add new system user with perl cgi?

Posted on 2000-03-21
5
146 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

863 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

22 Experts available now in Live!

Get 1:1 Help Now