--- Ron Powell <[EMAIL PROTECTED]> wrote: > I was recently reading Linux Administrators Handbook (by the > same folks who wrote Unix System Administrators Handbook) > and it mentioned that you could write a perl script to add > users, set their passwords, etc. > > The question is, could someone point me to a faq (faq only, > please - I'm keen to try it myself first) containing the > appropriate information? Originally, I was going to write > a shell script that used "expect"... but I'd much rather > use perl for it.
"Programming Perl"'s has list of functions by category, at the beginning of chapter 29. There is no standard doc that lists them all together... but the functions are: endgrent, endhostent, endnetent, endpwent, getgrent, getgrgid, getgrnam, getlogin, getpwent, getpwnam, getpwuid, setgrent, setpwent. The problem is, of course, that if your system uses "shadow"'d passwords you are going to have a problem... the password strings won't be available to you (via these functions) - and you won't be able to set them directly. Since you will be root anyway, you could just set passwords using the 'system' command or backticks [ qx() is preferred, as backticks don't always show well in all fonts ]. There is an Expect Module for Perl :) Jonathan Paton ===== $_=q|.,&@$$. ,.@$&@$. .&$$@. ,,$ ....!$_=$p.'&$@.',y'&$@' .,';for(/\S+/g){ !|.q| .$ .,@, ,$, .,.. @, ,$ ,,@ .,,.!++$.<22?${'y'.$_}=chr$.+64:[$$=${'y' !|.q| ,@$@&.,. $$$&, ..@&&$,,, $., ..!.$_},$y.=($.=~/22\|26\|3(3\|7)/x?' ' !|.q|. @ ., ,.&,,, , .$..&. .,$ .,,!.$$:"\l$$")]};$y=~/ (.*)/;warn"$1\n" !|.q|. $ .,. .,$$&&$...&., @.,.&@$@ .|,map{-$|--?$r:$p.=$_}split'!';eval$r __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]