System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

RHEL 5.5 user add with no password, force new password

 
SOLVED
Go to solution
Jason Moorhead_2
Frequent Advisor

RHEL 5.5 user add with no password, force new password

Hi all,

I need to create about 100 users from scratch, I'm a bit vexed on how to do the passwords. Ideally, I'd prefer to just create them all with no password, and force them to create one on first log in. Makes it much easier than to create unique passwords and email them each individually.

Is there any way to do this?

2 REPLIES
Steven E. Protter
Exalted Contributor
Solution

Re: RHEL 5.5 user add with no password, force new password

Shalom,

You can't create them using the useradd command with no password.

What you can do is this:

1) Make a list of users
2) Scripted useradd:

while read -r uname
do
useradd $uname
done
You can then take a look at /etc/shadow and look into blanking out the password field.

that is the second field.

user1:$1$`uZja@v`$rsU5HSDMm3L8NBF1z1QzL1:14851:0:99999:7:::
user2:$1$VqWhOgsI$UFIBP2jiJ4ph0UlwqKK5E0:14852:0:99999:7:::


Then you can rule the same while loop and issue a passwd -f $uname .

Note: creating users with blank passwords is probably a SOX violation.

Better to write an expect script and set the password and email it to the user in there.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jason Moorhead_2
Frequent Advisor

Re: RHEL 5.5 user add with no password, force new password

Thanks Stephen, I'll look into something with 'expect'. I hadn't even thought about that.