21

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

2 Answers 2

22

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>

4
  • 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, 2011 at 1:47
  • Thanks I checked the manpage and then checked google and changed the answer. Jan 25, 2011 at 2:19
  • 3
    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.
    – Hakanai
    Sep 28, 2017 at 4:31
  • I get NT_STATUS_IO_TIMEOUT. Is there a port that must be opened for this command to work? Aug 30, 2019 at 6:39
5

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).

#!/bin/bash

USER="your.username"
DOMAIN="yourdomain.com"

smbpasswd -U $USER -r `nslookup _ldap._tcp.dc._msdcs.$DOMAIN | awk '{print $2;exit;}'`
3
  • 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, 2016 at 21:37
  • @MikeS that command outputs multiple servers separated by whitespace, but I suspect that smbpasswd might want a single server.
    – Hakanai
    Sep 28, 2017 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, 2017 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .