What type of privs do you have on the box, or do you have super user/root access? Is LDAP installed on the system already, or PAM, or Expect.pm? I'll keep digging around and see what I can't make happen, but it may come down to editing the md5 digest pm, and finding the sub that actually creates the MD5 hash, and just adding that sub into your script, and then shelling it with the md5, but let me see what I can do.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Right, but what I'm asking is if LDAP is already installed on that box. If LDAP, or Expect.pm is on the box in question, then it will be no problem. If he does NOT have root access (which it seems he won't), then even manually opening and editing the shadow and passwd files isn't going to fly. I've got myself and 2 other people checking into this right now... it seems that passwd, along with su, demand input from the keyboard.... for security reasons. I'll keep you posted. I'm also unsure what --stdin does, I know it should be redirecting something to stdin, but what are you trying to pass this switch to?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Ok, where I got confused, was that my version of passwd didn't support --stdin, which caused a big headache. Knowing that the version you are going to run it on does support --stdin (you should do a man first on passwd to make sure for the server to ensure that --stdin will work with passwd on that server). This should suffice, however, to work with --stdin:
print "Enter Your Password: "; $oldpass = <STDIN>;
print "Enter Your New Password: "; $newpass = <STDIN>;
open (PASSWD, "| passwd --stdin");
print PASSWD "$oldpass";
print PASSWD "$newpass";
print PASSWD "$newpass";
close(PASSWD);
This is assuming that the passwd command will require 3 lines of text. The first line being the current password, the next line being the new password, and the last line being the confirmation of the new password. There is a more complicated Method, which I have to give the huge majority of credit to Narue, which requires detaching the process from the controlling terminal using ioctl, and if needed, I'll go back through that mess, and help with that. If, however, passwd on the server this will be run, supports --stdin, that's the way to go.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Appreciate it.... but most of that credit goes to Narue. I put forth my stretch of effort, but without her I'd still be looking.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215