Hello my friends,
I am setting up an old 486 machine (on a 'sandboxed' part of my home network) with a Slack install, to allow so of my friends to start working with linux at the shell. I am writing a Perl program to allow for 'anonymous' user creation; this program runs as the 'shell' of a special newuser account whose password I will hand out to folks I know who want to make a shell account.
Now here's the rub. I'm new to Perl, and am trying to implement lots of different little things in it to practice. I have been running into real difficulty in implementing the "useradd" and "passwd" programs from within the Perl program, once I have taken in and validated such things as what user name the person wants, etc.
How do you think I should be go about doing this securely? Right now I have:
system '/usr/sbin/useradd', "-u $uid", '-g 100', '-m', $username;
exec '/usr/bin/passwd', $username;
which is just simply not working. Do I fork a process to do this. I haven't even gotten to working on the "passwd" part (which I know will cause lots of trouble) as the "useradd" part is still on the fink.
Thanks so much, you guys are brilliant.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.