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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting a group of linux user ids 2

Status
Not open for further replies.

gamerland

Programmer
Apr 6, 2003
53
0
0
US
When creating a group of user ids for some reason all the passwords were bad. The command was:

useradd -gdevgrp -s/bin/sh -pt0day -d/home/jsmith -m jsmith

when they try to signon using t0day it get rejected. We reset the passwd with passwd jsmith and it works fine even when set back to t0day.

Two questions:
1. Do you see what is wrong with the command?
2. Is there a way to reset 60 passwords without doing it one at a time since it prompts for the new password to be entered twice?

BTW - this is RedHat Linux AS
 
I have a snippet for that..

Code:
## mass change passwords
users=( $(awk -F: '$3 >= 1000 && $1 != "nobody" { print $1 }' /etc/passwd) )
pws=( $(pwgen -cnsC) ) # password array
unset i
while [[ ${users[++i]} ]]; do echo ${users[i]} - ${pws[i]} >>/root/new_passwords; {
  sleep .3; echo ${pws[i]}; sleep .3; echo ${pws[i]}; } | passwd ${users[i]} 2>/dev/null; done

. Mac for productivity
.. Linux for developement
... Windows for solitaire
 
Just use passwd with stdin option so you can enter a clear text password
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top