Hi All, I'm writing a website on which users can change their Samba-password. I therefore use the smbpasswd-utility which I execute through the PHP function system (or exec, it doesn't really matter). I have to use the -s switch for smbpasswd to enable it to read input from STDIN, which I redirect to read the information from a file. I execute: /usr/local/samba/bin/smbpasswd -r ldap.domain.org -s -U maarten < /tmp/password.txt and the file password.txt contains the old password, and twice (or once, also doesn't seem to matter) the new password formatted like this: oldpassword newpassword newpassword. The output from smbpasswd is: 'Password changed for user maarten', which looks quite OK to me. But... the encrypted password does not at all look like the encrypted 'newpassword' as would be generated by a 'manual' run of smbpasswd. Worse, every time I use another 'newpassword' the encoding of its encrypted equivalent remains the same. Does anybody know what I'm doing wrong? I probably feed the passwords to smbpasswd totally wrong, but, how should it be done? Many, many thanks in advance! Maarten
Maarten, have you considered your bug being a PHP matter?! with my experience with Perl and PHP handling ASCI files is sometimes tricking in the matter of processing Carriage Returns and Line Feeds. maybe it is an idea to check if the lines in your /tmp/passwd.txt contain any of these Characters?!, I think they are 'chr(10)' and 'chr(13)'?! kind regardes Florian (fstahl@xantury.com)> -----Original Message----- > From: samba-bounces+fstahl=xantury.com@lists.samba.org > [mailto:samba-bounces+fstahl=xantury.com@lists.samba.org]On Behalf Of > Maarten Buiter > Sent: Wednesday, February 26, 2003 3:08 PM > To: samba@lists.samba.org > Subject: [Samba] Scripting with smbpasswd > > > Hi All, > > I'm writing a website on which users can change their Samba-password. > > I therefore use the smbpasswd-utility which I execute through the PHP > function system (or exec, it doesn't really matter). I have > to use the > -s switch > for smbpasswd to enable it to read input from STDIN, which I > redirect to > read the information from a file. > > I execute: > > /usr/local/samba/bin/smbpasswd -r ldap.domain.org -s -U maarten < > /tmp/password.txt > > and the file password.txt contains the old password, and > twice (or once, > also doesn't > seem to matter) the new password formatted like this: > > oldpassword > newpassword > newpassword. > > The output from smbpasswd is: 'Password changed for user > maarten', which > looks quite > OK to me. But... the encrypted password does not at all look like the > encrypted 'newpassword' > as would be generated by a 'manual' run of smbpasswd. Worse, > every time > I use another 'newpassword' the encoding of its encrypted equivalent > remains the same. > > Does anybody know what I'm doing wrong? I probably feed the > passwords to > smbpasswd totally wrong, but, how should it be done? > > Many, many thanks in advance! > > Maarten > > -- > To unsubscribe from this list go to the following URL and read the > instructions: http://lists.samba.org/mailman/listinfo/samba
Martin I'm not a programmer but my tests revealed the same result as yours. The encrypted password remains the same if you enter the old password again. Actually I was trying to use this to advantage by storing it in a history file for a ten or twelve values and comparing new to old to produce something like Nt4s password history check. want to give it a try? Richard Coates. On Thu, 2003-02-27 at 00:07, Maarten Buiter wrote:> Hi All, > > I'm writing a website on which users can change their Samba-password. > > I therefore use the smbpasswd-utility which I execute through the PHP > function system (or exec, it doesn't really matter). I have to use the > -s switch > for smbpasswd to enable it to read input from STDIN, which I redirect to > read the information from a file. > > I execute: > > /usr/local/samba/bin/smbpasswd -r ldap.domain.org -s -U maarten < > /tmp/password.txt > > and the file password.txt contains the old password, and twice (or once, > also doesn't > seem to matter) the new password formatted like this: > > oldpassword > newpassword > newpassword. > > The output from smbpasswd is: 'Password changed for user maarten', which > looks quite > OK to me. But... the encrypted password does not at all look like the > encrypted 'newpassword' > as would be generated by a 'manual' run of smbpasswd. Worse, every time > I use another 'newpassword' the encoding of its encrypted equivalent > remains the same. > > Does anybody know what I'm doing wrong? I probably feed the passwords to > smbpasswd totally wrong, but, how should it be done? > > Many, many thanks in advance! > > Maarten > > -- > To unsubscribe from this list go to the following URL and read the > instructions: http://lists.samba.org/mailman/listinfo/samba