User creation script

Aaron Konstam akonstam at sbcglobal.net
Thu Apr 26 20:15:07 UTC 2007


On Thu, 2007-04-26 at 15:05 -0500, Aaron Konstam wrote:
> On Thu, 2007-04-26 at 07:35 +0200, Joachim Backes wrote:
> > Tim wrote:
> > > On Wed, 2007-04-25 at 18:38 -0600, Ashley M. Kirchner wrote:
> > >>     Anyone have pointers (or examples) of a script that can be used to
> > >> create new users and set their password at the same time?  I need 
> > >> something I can call like so:
> > >>
> > >>     script USERNAME PASSWORD
> > >>
> > >>     ...and have it return 1 or 0 for failure or success. 
> > > 
> > > You can't use "useradd" as it already stands?
> > > 
> > 
> > I think the problem is the password.
> > Splitting the script in to parts:
> > 
> > 1. useradd   .... $1 .......
> > 2. password --stdin <<"EOF"
> > $2
> > EOF
> > 
> > so if you call
> > 
> > script <USERNAME> "<PASSWORD>"
> > 
> > the password should be set correctly.
> The problem as I see it is to generate passwds automatically. There used
> to be a program mkpasswd that did that but I can't find that now.
Well I spoke to soon. mkpasswd is part of the expect package and it
generates passwds that will make your script much simpler.
> 
--
=======================================================================
I'm sorry, but my karma just ran over your dogma.
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam at sbcglobal.net




More information about the fedora-list mailing list