Thank you I am very humbled for your help its very appreciated. I have my script pointing to one remote solaris 10 server for testing and this is what I see first in debug turned on to my screen and after that this is what I see in my log file.
First is my output to my screen from debugging.
# perl tester-a.pl
Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, 'ARRAY(0x1a31777
+0)', 'ARRAY(0x1a3177c0)') called at tester-a.pl line 32
main::change_password('solarishost') called at tester-a.pl lin
+e 20
Password: Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, '$') called at t
+ester-a.pl line 48
main::change_password('solarishost') called at tester-a.pl lin
+e 20
<code>
Last login: Wed Apr 8 10:32:54 2015 from mycomputer.
$ Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, 'Password:') cal
+led at tester-a.pl line 50
main::change_password('solarishost') called at tester-a.pl lin
+e 20
su - root
Password: Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, '#') called at t
+ester-a.pl line 52
main::change_password('solarishost') called at tester-a.pl lin
+e 20
[root@solarishost ~ ] # Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, '#') called at t
+ester-a.pl line 54
main::change_password('solarishost') called at tester-a.pl lin
+e 20
hostname
solarishost
[root@solarishost ~ ] # Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, '#') called at t
+ester-a.pl line 56
main::change_password('solarishost') called at tester-a.pl lin
+e 20
uptime
1:59pm up 10 day(s), 14:43, 4 users, load average: 5.19, 5.16, 4.
+90
[root@solarishost ~ ] # Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, 'New Password:')
+ called at tester-a.pl line 58
main::change_password('solarishost') called at tester-a.pl lin
+e 20
passwd amagana
New Password: Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, 'Re-enter new Pa
+ssword:') called at tester-a.pl line 60
main::change_password('solarishost') called at tester-a.pl lin
+e 20
Re-enter new Password: Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, '#') called at t
+ester-a.pl line 62
main::change_password('solarishost') called at tester-a.pl lin
+e 20
passwd: password successfully changed for amagana
[root@solarishost ~ ] # Starting EXPECT pattern matching...
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561
Expect::expect('Expect=GLOB(0x1a317160)', 60, '$') called at t
+ester-a.pl line 64
main::change_password('solarishost') called at tester-a.pl lin
+e 20
exit
logout
$ Closing spawn id(3).
at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431
Expect::hard_close('Expect=GLOB(0x1a317160)') called at /usr/l
+ib/perl5/site_perl/5.8.8/Expect.pm line 1621
Expect::DESTROY('Expect=GLOB(0x1a317160)') called at tester-a.
+pl line 20
eval {...} called at tester-a.pl line 20
main::change_password('solarishost') called at tester-a.pl lin
+e 20
Pid 4754 of spawn id(3) terminated, Status: 0xFF00
This is my log file results
vi /var/tmp/expect_script.log
======= system =======
^M
You are accessing a U.S. Government (USG) Information System (IS) th
+at is ^M
provided for USG-authorized use only.
+ ^M
+ ^M
By using this IS (which includes any device attached to this IS), yo
+u consent^M
to the following conditions:
+ ^M
+ ^M
-The USG routinely intercepts and monitors communications on this IS
+for ^M
purposes including, but not limited to, penetration testing, COMSEC
+ ^M
monitoring, network operations and defense, personnel misconduct (PM
+), law ^M
enforcement (LE), and counterintelligence (CI) investigations.
+ ^M
+ ^M
-At any time, the USG may inspect and seize data stored on this IS.
+ ^M
+ ^M
-Communications using, or data stored on, this IS are not private, ar
+e ^M
subject to routine monitoring, interception, and search, and may be
+ ^M
disclosed or used for any USG authorized purpose.
+ ^M
+ ^M
-This IS includes security measures (e.g.,authentication and access c
+ontrols)^M
to protect USG interests--not for your personal benefit or privacy.
+ ^M
+ ^M
-Notwithstanding the above, using this IS does not constitute consent
+ to PM, ^M
LE or CI investigative searching or monitoring of the content of pri
+vileged ^M
communications, or work product, related to personal representation
+or ^M
services by attorneys, psychotherapists, or clergy, and their assist
+ants. ^M
Such communications and work product are private and confidential.^M
Password: ^M
Last login: Wed Apr 8 10:32:54 2015 from mycomputer.^M^M
+---------------------------------------------------------------------
+--------+^M
|You are accessing a U.S. Government (USG) Information System (IS) tha
+t is |^M
|provided for USG-authorized use only.
+ |^M
|
+ |^M
|By using this IS (which includes any device attached to this IS), you
+ consent|^M
|to the following conditions:
+ |^M
|
+ |^M
|-The USG routinely intercepts and monitors communications on this IS
+for |^M
| purposes including, but not limited to, penetration testing, COMSEC
+ |^M
| monitoring, network operations and defense, personnel misconduct (PM
+), law |^M
| enforcement (LE), and counterintelligence (CI) investigations.
+ |^M
|
+ |^M
|-At any time, the USG may inspect and seize data stored on this IS.
+ |^M
|
+ |^M
|-Communications using, or data stored on, this IS are not private, ar
+e |^M
| subject to routine monitoring, interception, and search, and may be
+ |^M
| disclosed or used for any USG authorized purpose.
+ |^M
|
+ |^M
|-This IS includes security measures (e.g.,authentication and access c
+ontrols)|^M
| to protect USG interests--not for your personal benefit or privacy.
+ |^M
|
+ |^M
|-Notwithstanding the above, using this IS does not constitute consent
+ to PM, |^M
| LE or CI investigative searching or monitoring of the content of pri
+vileged |^M
| communications, or work product, related to personal representation
+or |^M
| services by attorneys, psychotherapists, or clergy, and their assist
+ants. |^M
| Such communications and work product are private and confidential.
+ |^M
+---------------------------------------------------------------------
+--------+^M
$ su - root^M
Password: ^M
+---------------------------------------------------------------------
+--------+^M
|You are accessing a U.S. Government (USG) Information System (IS) tha
+t is |^M
|provided for USG-authorized use only.
+ |^M
|
+ |^M
|By using this IS (which includes any device attached to this IS), you
+ consent|^M
|to the following conditions:
+ |^M
|
+ |^M
|-The USG routinely intercepts and monitors communications on this IS
+for |^M
| purposes including, but not limited to, penetration testing, COMSEC
+ |^M
| monitoring, network operations and defense, personnel misconduct (PM
+), law |^M
| enforcement (LE), and counterintelligence (CI) investigations.
+ |^M
|
+ |^M
|-At any time, the USG may inspect and seize data stored on this IS.
+ |^M
|
+ |^M
|-Communications using, or data stored on, this IS are not private, ar
+e |^M
| subject to routine monitoring, interception, and search, and may be
+ |^M
| disclosed or used for any USG authorized purpose.
+ |^M
|
+ |^M
|-This IS includes security measures (e.g.,authentication and access c
+ontrols)|^M
| to protect USG interests--not for your personal benefit or privacy.
+ |^M
|
+ |^M
|-Notwithstanding the above, using this IS does not constitute consent
+ to PM, |^M
| LE or CI investigative searching or monitoring of the content of pri
+vileged |^M
| communications, or work product, related to personal representation
+or |^M
| services by attorneys, psychotherapists, or clergy, and their assist
+ants. |^M
| Such communications and work product are private and confidential.
+ |^M
+---------------------------------------------------------------------
+--------+^M
^[[01m[root@solarishost ~ ]^[[m # hostname^M
solarishost^M
^[[01m[root@solarishost ~ ]^[[m # uptime^M
1:59pm up 10 day(s), 14:43, 4 users, load average: 5.19, 5.16, 4.
+90^M
^[[01m[root@solarishost ~ ]^[[m # passwd amagana^M
New Password: ^M
Re-enter new Password: ^M
passwd: password successfully changed for amagana^M
^[[01m[root@solarishost ~ ]^[[m # exit^M
logout^M
$
|