Operating System - HP-UX
1820475 Members
3314 Online
109624 Solutions
New Discussion юеВ

Change UNIX password by batch via a shell script

 
Rita Li
Frequent Advisor

Change UNIX password by batch via a shell script

We are going to launch a new application server to replace the old one (a database application)

We held some basic trainings more than a month ago to teach all the users how to change the UNIX and/or application's password. Some did change his/her UNIX password during the training but most of them have forgotten what's the new password that they have changed to

We have 400+ user acocunts & I want to reset all the UNIX passwords then send out an email to tell every one how to logon the first day when the new application goes production

eg. The Login ID is "test", the password is "test123". (passwd = adding 123 to the login ID). Then issue a "passwd -f $username" command to force everyone changing his/her password at the first logon

How can I do this password change by batch via a shell script?

Appreciate anyone who can reder me help on this

Rita
3 REPLIES 3
Wouter Jagers
Honored Contributor

Re: Change UNIX password by batch via a shell script

Hi Rita,

There was a similar question recently, check out these threads:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1087562
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1087561

Do these help you out ?

Cheers
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
Steven E. Protter
Exalted Contributor

Re: Change UNIX password by batch via a shell script

Shalom Rita,

Essentially you need a user list.

cat /etc/passwd | awk '{ print $1 }' > list
# edit the list
while read -r uname
do
# passwd reset code goes here.

# call SEP's handy email with attachment script
done
# email attachment script:
http://www.hpux.ws/mailfile2

This script is a little over-engineered and you might just want to harvest the email portion of it instead of using the whole thing.

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
Rita Li
Frequent Advisor

Re: Change UNIX password by batch via a shell script

Able to come up with a script finally that works, thanks