tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: Mass-adding user accounts under Enhanced Security
@ 1998-05-12 17:41 Jane Kramer
  0 siblings, 0 replies; only message in thread
From: Jane Kramer @ 1998-05-12 17:41 UTC (permalink / raw)
  To: tru64-unix-managers

Original post by Jane Kramer:
> 
> Hello,
> 
> We're configuring a new system here, running Digital UNIX 4.0D with
> Enhanced Security.  I want to write a script or program to mass-add
> accounts (we have an influx of new students every Fall), invoking
> useradd.  As far as I can tell, useradd is the best utility for doing
> this.
> 
> Has anyone done this, *and* been able to set pre-determined passwords
> (all of which are different) for the accounts via the script?

Thanks to all who replied.  The key to the problem is that under
Enhanced Security, the password is not stored in /etc/passwd, and the
useradd command does not have an option to set passwords.

The solution to mass-adding accounts is to write a script (in the form
of your choice: Perl, Csh, whatever) that essentially does the
following:

	read input-file-containing-list-of-users-and-passwords
	for each user
		invoke 'useradd' with correct arguments
		invoke Expect script to set password
	end

Here's a copy of an Expect script that works with the Enhanced Security
version of 'passwd':

#!/usr/local/bin/expect -f
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, 
# password type is passed as 2nd arg,
# desired password as 3rd

set pick [lindex $argv 1]
set password [lindex $argv 2]
spawn passwd [lindex $argv 0]
expect "choice:"
send "$pick\r"
expect "password:"
send  "$password\r"
send "\r"
expect "password:"
send  "$password\r"
expect eof



Information on Expect is available at
http://elib.cme.nist.gov/pub/expect.

Tcl (required by Expect) is available at ftp://ftp.smli.com/pub/tcl/.

-- 
====================================================================
Jane Kramer                            
Computer Systems Manager, Oberlin College
Jane.Kramer@oberlin.edu
440-775-6929
====================================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-05-12 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-05-12 17:41 SUMMARY: Mass-adding user accounts under Enhanced Security Jane Kramer

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