1834722 Members
2495 Online
110069 Solutions
New Discussion

hp9000 user passwords

 
SOLVED
Go to solution
Martin Zelling_1
Occasional Contributor

hp9000 user passwords

How do I force the creation of a user password in my script without it asking me for my input? My company's policy is that every user's password is their initials plus their employee ID number.
3 REPLIES 3
Jitendra_1
Trusted Contributor
Solution

Re: hp9000 user passwords

The passwd command is interactive and there is no way to make it non-interactive. The way out may be to use expect language and supply the answers it expects . This way you can preanswer the passwd you want it to accept. Howevere you may need to learn expect a bit.

hope this helps. You may find expect on the HP archive and porting site.
Learning is the Key!
Bruce Regittko_1
Esteemed Contributor

Re: hp9000 user passwords

Hi,

Another option you can pursue is to create the encrypted password string with makekey(1) and then use sed, perl, and/or awk to place it in the /etc/passwd file. You will have to create a 2 character "salt" value to seed the encryption algorithm.

Attached is a quick and dirty POSIX script that uses the RANDOM variable to create the salt and read's the password from the command line to create the password string. This should be enough to get you started.

--Bruce
www.stratech.com/training
Michael F. Dick
Advisor

Re: hp9000 user passwords

Use expect....
Well, thats all just my $.02