Oops, I missed a step. Hopefully better (still untested) code: use Net::Telnet; $t = new Net::Telnet; $t->open("localhost"); $t->login($username, $oldpass); $t->cmd(String=>'passwd',Prompt=>':'); # passwd command $t->cmd(String=>$oldpass,Prompt=>':'); # old password $t->cmd(String=>$newpass,Prompt=>':'); # new password @result = $t->cmd(String=>$newpass); # new password again print @result;
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Thomas, Mark - BLS CTR > Sent: Friday, June 25, 2004 8:51 AM > To: 'Mundell, R. (Ronald)' > Cc: Perl-Unix-Users (Perl-Unix-Users) > Subject: [Perl-unix-users] RE: Help changing a password > > > use Net::Telnet and it's easy. Untested code: > > use Net::Telnet; > $t = new Net::Telnet; > $t->open("localhost"); > $t->login($username, $passwd); > $t->cmd(String=>'passwd',Prompt=>':'); > $t->cmd(String=>$passwd,Prompt=>':'); > @result = $t->cmd(String=>$passwd); > print @result; > > > -- > Mark Thomas [EMAIL PROTECTED] > Internet Systems Architect DigitalNet, Inc. > > $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; > ;y;y; ;;print;; > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Mundell, R. (Ronald) > Sent: Friday, June 25, 2004 4:51 AM > To: [EMAIL PROTECTED]; > '[EMAIL PROTECTED]' > Subject: Help changing a password > > > Good Day All > > I am trying to change a password in a Perl script. Does > anyone know how to do this? > > Eg. > > passwd user1 > Changing password for "user1" > user1's Old password: 123456 > user1's New password: abcde123 > Enter the new password again: abcde123 > > > > Ronald Mundell > > > > > This email and any accompanying attachments may contain > confidential and proprietary information. This information > is private and protected by law and, accordingly, if you are > not the intended recipient, you are requested to delete this > entire communication immediately and are notified that any > disclosure, copying or distribution of or taking any action > based on this information is prohibited. > Emails cannot be guaranteed to be secure or free of errors or > viruses. The sender does not accept any liability or > responsibility for any interception, corruption, destruction, > loss, late arrival or incompleteness of or tampering or > interference with any of the information contained in this > email or for its incorrect delivery or non-delivery for > whatsoever reason or for its effect on any electronic device > of the recipient. If verification of this email or any > attachment is required, please request a hard-copy version. > > _______________________________________________ > Perl-Unix-Users mailing list [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs