Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create multiple users with passwords

Status
Not open for further replies.

TheLad

Technical User
Aug 3, 2001
3,846
GB
Guys

Apologies if this is a basic question, I am new to Solaris and I have inherited a system.

I have inherited a user creation script but it requires the password to be set on the account to be typed in manually. Is there any way of automating the password part? The script is as follows:

Code:
useradd -c 'Fred Bloggs' -d '/export/home/bloggsf'  -g staff -G root -m -k /etc/skel -s /sbin/sh bloggsf ; passwd bloggs

Is there a way of setting the password as part of the useradd process without calling passwd? Or is there a way of forcing a password string into passwd?

Thanks in advance

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
I don't know of any "good" way to script the passwd part.
I think manually is your best option. Your script even calls passwd for you. I assume when you run the script you are prompted to set the passwd? That's how I do it anyway. No much fuss, just setting a passwd.
 
Look into EXPECT. With your script and some EXPECT scripting, you can make it add 1 or 100 users with passwords - no input from you required... other than kicking the script off.

Add a little color to your PUTTY terminal: faq52-6627
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top