Is there a way to change my Windows domain password from Linux?


I've done this on OS X, the same command exist on linux.

According to this site. Looks like the way to avoid adding the username to smbpasswd file to use smbpasswd -U <user> -r <IP address of DC>

| improve this answer | |
  • According to the smbpasswd man page, this won't do the right thing; the -a flag means "the username following should be added to the local smbpasswd file". It's possible that the man page is incorrect; but I'm suspicious. – larsks Jan 25 '11 at 1:47
  • Thanks I checked the manpage and then checked google and changed the answer. – JamesBarnett Jan 25 '11 at 2:19
  • 2
    Error was : NT_STATUS_ACCESS_DENIED. But if I use smbclient -L to try and list servers, I get a different error message that my password has expired, which implies that the password I'm typing is correct. – Trejkaz Sep 28 '17 at 4:31
  • I get NT_STATUS_IO_TIMEOUT. Is there a port that must be opened for this command to work? – Christoffer Reijer Aug 30 '19 at 6:39

I'm using the same solution as @JamesBarnett, I've just created a script that also gets the domain controller IP too (I never know what the IP is when I need to change my password).



smbpasswd -U $USER -r `nslookup _ldap._tcp.dc._msdcs.$DOMAIN | awk '{print $2;exit;}'`
| improve this answer | |
  • 1
    The nslookup command will not work as given, because the ldap record is of DNS type SRV. You need to perform: nslookup -type=SRV ...etc... and filter it appropriately (it's more complicated than a simple awk), or better yet: $(dig SRV +noall +additional _ldap._tcp.dc._msdcs.$DOMAIN | awk '{print $5}') replaces the entire nslookup between the backticks that you have, above. – Mike S Nov 21 '16 at 21:37
  • @MikeS that command outputs multiple servers separated by whitespace, but I suspect that smbpasswd might want a single server. – Trejkaz Sep 28 '17 at 4:33
  • @Trejkaz Yes, that's what I mean by "filter it appropriately". The DNS records are of type SRV, that's for starters. How you get the SRV records I have shown. Now, how you choose a domain controller, that part I'm not sure of. – Mike S Oct 2 '17 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.