[Samba] unix password sync doesn't update smbpasswd file! SOLVED !

Mac dmccann at nibsc.ac.uk
Tue Feb 26 12:45:04 GMT 2002


Hi all (again),

I think I've solved the problem:-

>To: samba at samba.org
>From: Mac <dmccann at nibsc.ac.uk>
>Subject: [Samba] unix password sync doesn't update smbpasswd file!
>Date: Tue, 26 Feb 2002 16:53:36 +0000 (GMT)
>
>When unix password sync = yes
>	smbpasswd works, but only the UNIX password is changed
>
>When unix password sync = no
>	smbpasswd works, and only the encrypted password is changed.


And the answer's right here in my original post:-


>Could it be a 'passwd chat' issue?  Mine is currently:-
>	*new*password %n\n *new*password %n\n *updating*database*
>
>
>And a typical (root) session with the passwd command is:-
>	# passwd jkent
>	Changing local password for jkent.
>	New password:
>	Retype new password:
>	passwd: updating the database...
>	passwd: done
>	#


The 'passwd chat' (it appears) _must_ consume _all_ of the output of the
'passwd program'. (mine stops one line before the end)

So my chat string (which talks to 'passwd' OKay) doesn't use up the last
line of 'passwd's output, so it changes the UNIX password but then hangs
around, and so the smbd changing my password hangs around too, and never
gets round to changing the SMB (encrypted password). Solution:-

Change chat string to :-
   *new*password* %n\n *new*password* %n\n *updating*the*database*done*

So now it reads the last line as well and the child (i.e. 'passwd') exits
and the (parent) smbd changes the SMB password.  Hurrah!

Note.  Even though the 'done' is the last thing that 'passwd' outputs
the chat string still needs a '*' at the end of it to 'gobble up' the
End-of-Line that follows the 'done'.  [1]


And now it all works smoothly, both passwords updated when smbpasswd is
run.


Could someone stick a note in the Doco somewhere about this?  Writing
chat scripts is tricky at the best of times (and _having_ to use debug
level 100 doesn't help), so a note to the effect that the chat script
needs to keep talking right to the end of the 'passwd' program's output
would be handy.


                               Mac
          Assistant Systems Adminstrator @nibsc.ac.uk
                        dmccann at nibsc.ac.uk
   Work: +44 1707 654753 x285      Everything else: +44 7956 237670 (anytime)

[1] Actually, I've just discovered you can specify `\n` instead of the
final '*'.




More information about the samba mailing list