[Samba] AD passwd change

Kaustubh Chaudhari c_kitu at yahoo.co.in
Tue Jan 9 10:39:07 GMT 2007


Hi Andy,

>From the man page of smbpasswd.

====
      -r remote machine name
              This  option  allows a user to specify what machine they
wish to change their password on. Without this parameter smbpasswd
defaults to the
              local host. The remote machine name is the NetBIOS name of
the SMB/CIFS server to contact to attempt the password change. This name
is  re-
              solved  into  an  IP address using the standard name
resolution mechanism in all programs of the Samba suite. See the -R name
resolve order
              parameter for details on changing this resolving
mechanism.

              The username whose password is changed is that of the
current UNIX logged on user. See the -U username parameter for  details
on  changing
              the password for a different username.

              Note that if changing a Windows NT Domain password the
remote machine specified must be the Primary Domain Controller for the
domain (Back-
              up Domain Controllers only have a read-only copy of the
user account database and will not allow the password change).

              Note that Windows 95/98 do not have a real password
database so it is not possible to change passwords specifying a Win95/98
machine as re-
              mote machine target.
====


Regards,
Kaustubh

On Mon, 2007-01-08 at 10:30 -0800, Andrew Morgan wrote:
> On Sun, 7 Jan 2007, Azher Amin wrote:
> 
> > Hi,
> >
> > Can someone guide me, how to change the password of windows AD using a linux 
> > script.
> 
> Here is a snippet of perl code we use to change AD passwords:
> 
>    my $unicodepwd = pack("v*", (unpack("C*", "\"$newpw1\"")));
>    $mesg = $ad->modify($addn, replace => { unicodepwd => $unicodepwd });
> 
> Where $newpw1 is the new password, and $ad is a Net::LDAPS object 
> connected to an AD domain controller as a user with privileges to update 
> passwords.
> 
>  	Andy



More information about the samba mailing list