Operating System - HP-UX
1833687 Members
4143 Online
110062 Solutions
New Discussion

Re: change password scripts

 
SOLVED
Go to solution
Prasad Pati
New Member

change password scripts

how can we change password through scripts in hp-ux 11.0. Or any utilities available?
10 REPLIES 10
John Dvorchak
Honored Contributor

Re: change password scripts

Currently there are no provisions in HPUX that I know of to change a passwd via a script. I have heard though, that you can download something called "expect" that will simulate an interactive session.

Good luck
If it has wheels or a skirt, you can't afford it.
Zafar A. Mohammed_1
Trusted Contributor

Re: change password scripts

I hope we can achieve this by Perl if we can delay, like we used to do in Perl telnet module. I am not sure, but I'll certainly spend time on it and let you know.

Thanks
Zafar
doug hosking
Esteemed Contributor
Solution

Re: change password scripts

Yes, 'expect' has some features that claim to support this.

http://expect.nist.gov

is where you can find expect.

http://expect.nist.gov/example/autopasswd

shows an example.
Balaji N
Honored Contributor

Re: change password scripts

here is a sample script using expect.

u can get expect from here

http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.38/


+++++++++++++++++++++++++
[balajin@redpenguin X11]$ more /usr/bin/autopasswd
#!/usr/bin/expect -f
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd

set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof
+++++++++++++++++++++++++


hth
-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Balaji N
Honored Contributor

Re: change password scripts

hi
u might need this dependancy as well for installing expect

http://hpux.connect.org.uk/hppd/hpux/Tcl/tcltk-8.3.4/


hth
-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Andrew_80
Advisor

Re: change password scripts

First you need to change the password in one system only, and then use a script to copy this password to the other systems, this is possible even if you are using a trusted system.
The Sky is the Limit
A. Clay Stephenson
Acclaimed Contributor

Re: change password scripts

Scripts are the less than optimal method. You would be far better served by implementing NIS (or better NIS+) and manage your passwords in one place.
If it ain't broke, I can fix that.
John Meissner
Esteemed Contributor

Re: change password scripts

yes you could do this with expect. I'll attach a sample script for you. basically once installed you would type:
autoexpect -f telnet hostname
#where filename is insert the name you want to save your script to. Then proceed to use the passwd command to change your password.

you will need to edit your script then to remove things such as the date/time otherwise the script will not work.
All paths lead to destiny
Rita C Workman
Honored Contributor

Re: change password scripts

Are you looking to change 1 password or are you looking to maybe do a mass password change? changing a group of identifiable users to a new/same password?

Just asking,
Rita
Prasad Pati
New Member

Re: change password scripts

Thanks everybody for your quick response.