Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* add +200 users and set the password automatically
@ 2000-12-04  5:00 Norbert Gnipp
  2000-12-04  5:00 ` Adriano Prado
  2001-04-28 17:41 ` system PRIVILEGED account
  0 siblings, 2 replies; 4+ messages in thread
From: Norbert Gnipp @ 2000-12-04  5:00 UTC (permalink / raw)


Hi there,

We are planning to add up to 200 users on out Tru64 V5.0a Server.
To add an user account is not a problem, but to set up the password.

So we are looking for help to set the password automatically.

Normally the unix password program want a user action to set the
password, but in our case we want that we can use the password
program with a parameter or a variable to set the password without
an user action.


Regards
N. Gnipp






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: add +200 users and set the password automatically
  2000-12-04  5:00 add +200 users and set the password automatically Norbert Gnipp
@ 2000-12-04  5:00 ` Adriano Prado
  2001-04-28 17:41 ` system PRIVILEGED account
  1 sibling, 0 replies; 4+ messages in thread
From: Adriano Prado @ 2000-12-04  5:00 UTC (permalink / raw)


You could use the Expect to do such task.

A simple Expect script would be:
_______________________________
#!/usr/local/bin/expect --

set user [lindex $argv 0]
set key  [lindex $argv 1]

spawn csh
expect %
send "passwd $user\r";
expect "New password:"
send "$key\r"
expect "Retype new password:"
send "$key\r"
expect %
--------------------------------

where you call your script like this: script_name <user_name> <password>



In article <3A2BB32E.9E8F2159@manor.ch>,
  Norbert Gnipp <norbert.gnipp@manor.ch> wrote:
> Hi there,
>
> We are planning to add up to 200 users on out Tru64 V5.0a Server.
> To add an user account is not a problem, but to set up the password.
>
> So we are looking for help to set the password automatically.
>
> Normally the unix password program want a user action to set the
> password, but in our case we want that we can use the password
> program with a parameter or a variable to set the password without
> an user action.
>
> Regards
> N. Gnipp
>
>

--
Adriano Prado
_______________________
prado@gmx.net


Sent via Deja.com http://www.deja.com/
Before you buy.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: add +200 users and set the password automatically
  2000-12-04  5:00 add +200 users and set the password automatically Norbert Gnipp
  2000-12-04  5:00 ` Adriano Prado
@ 2001-04-28 17:41 ` system PRIVILEGED account
  2001-05-02 12:58   ` Chuck
  1 sibling, 1 reply; 4+ messages in thread
From: system PRIVILEGED account @ 2001-04-28 17:41 UTC (permalink / raw)


Norbert Gnipp wrote:

> Hi there,
>
> We are planning to add up to 200 users on out Tru64 V5.0a Server.
> To add an user account is not a problem, but to set up the password.
>
> So we are looking for help to set the password automatically.
>
> Normally the unix password program want a user action to set the
> password, but in our case we want that we can use the password
> program with a parameter or a variable to set the password without
> an user action.
>
> Regards
> N. Gnipp

you could set the password to be random then use a script running from
root to passwd each account *or*
you could just set the password field to :: in the etc/passwd and expire
those accounts so they would have to change after first login



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: add +200 users and set the password automatically
  2001-04-28 17:41 ` system PRIVILEGED account
@ 2001-05-02 12:58   ` Chuck
  0 siblings, 0 replies; 4+ messages in thread
From: Chuck @ 2001-05-02 12:58 UTC (permalink / raw)


In a similar situation I used the following script to set
initial passwords to "loginname-numericuserid".  Could be
modified to create random passwords instead.   Hope this
helps.

Needs to be called for each user name as in something like:
for u in `cat names.lst`
do
    setinitialpw $u
done

--- setinitialpw script below -- Must be run as root of
course

PRG=`basename $0`
usedefaultpw=y
if [ $# -lt 1 ]; then
        echo "Need a user name argument.\nAbort"
        exit 1
fi

## Subroutine
setdefaultpw(){
        pw=${user}-${uid}
        /usr/sbin/usermod -p $user <<EOF
$pw
$pw
EOF

        if [ $? ]; then
                echo "Set Password $pw for $user $comment"
                return 0
        else
                echo "Could not set password $pw for $user
$comment"
                return 1
        fi
}

user=$1
pwline=`grep "^$user:" /etc/passwd`
if [ -z "$pwline" ]; then
        print "$PRG ERROR: Could get info from /etc/passwd
for user [$user].\Abort"
        exit 2
fi
uid=`echo "$pwline" | cut -d : -f 3`
comment=`echo "$pwline" | cut -d : -f 5`
if [ -z "$uid" ]; then
        print "$PRG ERROR: Could not extract UID for user
[$user].\Abort"
        exit 3
fi
if [ "$usedefaultpw" != "y" ]; then
        echo "Other than default pw not implemented
yet.\nAbort"
        exit 4
else
        setdefaultpw
        rval=$?
        if [ $rval -ne 0 ]; then
                exit 5
        fi
fi
exit 0




"system PRIVILEGED account" <plindsey@coserv.net> wrote in
message news:3AEB00D4.732082AE@coserv.net...
> Norbert Gnipp wrote:
>
> > Hi there,
> >
> > We are planning to add up to 200 users on out Tru64
V5.0a Server.
> > To add an user account is not a problem, but to set up
the password.
> >
> > So we are looking for help to set the password
automatically.
> >
> > Normally the unix password program want a user action to
set the
> > password, but in our case we want that we can use the
password
> > program with a parameter or a variable to set the
password without
> > an user action.
> >
> > Regards
> > N. Gnipp
>
> you could set the password to be random then use a script
running from
> root to passwd each account *or*
> you could just set the password field to :: in the
etc/passwd and expire
> those accounts so they would have to change after first
login
>
>




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-02 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-04  5:00 add +200 users and set the password automatically Norbert Gnipp
2000-12-04  5:00 ` Adriano Prado
2001-04-28 17:41 ` system PRIVILEGED account
2001-05-02 12:58   ` Chuck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox