SMBPASSWD(8)
π SMBPASSWD(8) β System Administration tools π
okay so bestie, you've stumbled into smbpasswd(8), and it lives in the System Administration tools corner of the manual-verse. no cap, this one's a whole vibe.
β¨ NAME β¨
smbpasswd β change a user's SMB password π
πΈ SYNOPSIS πΈ
smbpasswd [-a] [-c <config file>] [-x] [-d] [-e] [-D debuglevel] [-n]
[-r <remote machine>] [-R <name resolve order>] [-m]
[-U username[%password]] [-h] [-s] [-w pass] [-W] [-i] [-L] [username]
π DESCRIPTION π
This tool is part of the samba(7) suite. slay.
So here's the tea: smbpasswd is giving multiple functions depending on whether you're running it as root or not. It's giving β¨versatileβ¨. When a normal user runs it, it lets you change the password used for your SMB sessions on literally any machine that stores SMB passwords. your password, your rules π
By default β that's when you run it with no arguments at all β it'll try to change the current user's SMB password on the local machine. Very demure, very mindful. It's similar to how the passwd(1) program works, but here's where smbpasswd says "not me being different": it is not setuid root. instead it works in a client-server mode and talks to a locally running smbd(8). so as a consequence β and this is important bestie β for this to actually succeed, the smbd daemon must be running on the local machine. no smbd, no vibes. on a UNIX machine, the encrypted SMB passwords are usually stored in the default passdb backend.
π«Ά real talk: no smbd daemon running locally = it's not gonna work. periodt.
When an ordinary user runs it with no options, smbpasswd will prompt them for their old SMB password and then ask for their new password twice, so you can't typo your way into a locked account. iconic safety behaviour honestly. no passwords will be echoed on the screen while you're typing them β the terminal said π. and if you have a blank SMB password? that's the one specified by the string "NO PASSWORD" in the smbpasswd file. in that case just press the Enter key when it asks for your old password. easy.
smbpasswd can also be used by a normal user to change their SMB password on remote machines, like Windows NT Primary Domain Controllers. for that, go look at the (-r) and -U options below π
When root runs it, smbpasswd lets you add and delete new users in the smbpasswd file, and also lets you change the attributes of the user in this file. main character energy honestly. and when root runs it, smbpasswd accesses the local smbpasswd file directly β which means changes can be made even if smbd is not running. the root privilege said "I don't need the daemon, I AM the daemon" π
β¨ OPTIONS β¨
okay bestie, this is the part where smbpasswd shows off everything it can do π every flag, every argument, all of it. read carefully, some of these are root-only and some of them will straight up yell at you if your password file is ancient π
-aβ adds the username that follows to the local smbpasswd file, with the new password typed (just hit Enter for the old password). If that username already exists in the smbpasswd file, this option gets ignored and it's treated like a regular change-password command instead. Heads up though: the default passdb backends need the user to already exist in the system password file (usually/etc/passwd), otherwise the request to add the user will FAIL.
This option is only available when you're running smbpasswd as root. π
-cβ lets you specify the path and file name of the/etc/samba/smb.confconfiguration file, for when it's important to use something other than the default file and/or location.-xβ deletes the username that follows from the local smbpasswd file.
This option is only available when you're running smbpasswd as root. π
-dβ disables the username that follows in the local smbpasswd file. How? By writing a'D'flag into the account control space in the smbpasswd file. Once that's done, every single attempt to authenticate via SMB with this username will fail. byeee π
If the smbpasswd file is in the 'old' format (that's pre-Samba 2.0 format), there's literally no space in the user's password entry to write this information, and the command will FAIL. See smbpasswd(5) for the deets on the 'old' and new password file formats.
This option is only available when you're running smbpasswd as root. π
-eβ enables the username that follows in the local smbpasswd file, if the account was previously disabled. If it wasn't disabled, this option does absolutely nothing, no effect, nada. Once the account is enabled, the user can authenticate via SMB once again. welcome back bestie π«Ά
If the smbpasswd file is in the 'old' format, then smbpasswd will FAIL to enable the account. See smbpasswd(5) for the deets on the 'old' and new password file formats.
This option is only available when you're running smbpasswd as root. π
-D debuglevelβdebuglevelis an integer from0to10. The default value if this parameter isn't specified is zero.
The higher this value, the more detail gets logged to the log files about what smbpasswd is up to. At level 0, only critical errors and serious warnings get logged.
Levels above 1 generate considerable amounts of log data, so only use them when you're investigating a problem. Levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic. like, you will not understand it, ngl π
-nβ says the username that follows should have their password set to null (i.e. a blank password) in the local smbpasswd file. This is done by writing the string"NO PASSWORD"as the first part of the first password stored in the smbpasswd file.
Note that to allow users to logon to a Samba server once the password has been set to "NO PASSWORD" in the smbpasswd file, the administrator must set the following parameter in the [global] section of the smb.conf file:
null passwords = yes
This option is only available when you're running smbpasswd as root. π
-r remote machine nameβ this option allows a user to specify what machine they wish to change their password on. Without this parametersmbpasswddefaults 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 gets resolved into an IP address using the standard name resolution mechanism in all programs of the Samba suite. See the-R name resolve orderparameter 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 you're changing a Windows NT Domain password, the remote machine specified must be the Primary Domain Controller for the domain (Backup 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 the remote machine target.
-R name resolve orderβ this option lets the user ofsmbpasswddetermine what name resolution services to use when looking up the NetBIOS name of the host being connected to.
The options are: "lmhosts", "host", "wins" and "bcast". They cause names to be resolved as follows:
lmhosts: lookup an IP address in the Samba lmhosts file. If the line in lmhosts has no name type attached to the NetBIOS name (see thelmhosts(5)for details), then any name type matches for lookup.host: do a standard host name to IP address resolution, using the system/etc/hosts, NIS, or DNS lookups. This method of name resolution is operating system dependent β for instance, on IRIX or Solaris this may be controlled by the/etc/nsswitch.conffile. Note that this method is only used if the NetBIOS name type being queried is the0x20(server) name type, otherwise it is ignored.wins: query a name with the IP address listed in thewins serverparameter. If no WINS server has been specified, this method will be ignored.bcast: do a broadcast on each of the known local interfaces listed in theinterfacesparameter. This is the least reliable of the name resolution methods, since it depends on the target host being on a locally connected subnet.
The default order is lmhosts, host, wins, bcast β and without this parameter or any entry in the smb.conf(5) file, the name resolution methods will be attempted in this order.
-mβ tellssmbpasswdthat the account being changed is a MACHINE account. Currently this is used when Samba is being used as an NT Primary Domain Controller.
This option is only available when you're running smbpasswd as root. π
-U usernameβ this option may only be used in conjunction with the-roption. When changing a password on a remote machine, it allows the user to specify the user name on that machine whose password will be changed. It's present to allow users who have different user names on different systems to change these passwords.-hβ prints the help string forsmbpasswd, selecting the correct one for running as root or as an ordinary user.-sβ causessmbpasswdto be silent (i.e. not issue prompts) and to read its old and new passwords from standard input, rather than from/dev/tty(like thepasswd(1)program does). This option is here to aid people writing scripts to drivesmbpasswd. script girlies, this one's for you π-w passwordβ this parameter is only available if Samba has been compiled with LDAP support. The-wswitch is used to specify the password to be used with theldap admin dn. Note that the password is stored in thesecrets.tdband is keyed off of the admin's DN. This means that if the value ofldap admin dnever changes, the password will need to be manually updated as well. remember that bestie, it does not update itself β¨-Wβ NOTE: this option is the same as"-w"except that the password should be entered using stdin.
This parameter is only available if Samba has been compiled with LDAP support. The -W switch is used to specify the password to be used with the ldap admin dn. Note that the password is stored in the secrets.tdb and is keyed off of the admin's DN. This means that if the value of ldap admin dn ever changes, the password will need to be manually updated as well.
-iβ tellssmbpasswdthat the account being changed is an interdomain trust account. Currently this is used when Samba is being used as an NT Primary Domain Controller. The account contains the info about another trusted domain.
This option is only available when you're running smbpasswd as root. π
-Lβ run in local mode.usernameβ this specifies the username for all of the root-only options to operate on. Only root can specify this parameter, since only root has the permission needed to modify attributes directly in the local smbpasswd file. π
π¦ NOTES π¦
Since smbpasswd works in client-server mode, communicating with a local smbd for a non-root user, the smbd daemon must be running for this to work. A common problem? Adding a restriction to the hosts that may access the smbd running on the local machine by specifying either allow hosts or deny hosts entry in the smb.conf(5) file β and then neglecting to allow "localhost" access to the smbd. the way that one trips people up every single time π
In addition, the smbpasswd command is only useful if Samba has been set up to use encrypted passwords.
π VERSION π
This man page is part of version 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1 of the Samba suite.
π SEE ALSO π
π AUTHOR π
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed.
okay that's the whole thing bestie, you ate that πβ¨ this page is from Samba 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1 of the Samba suite, and it's dated 09/13/2026 β go change some passwords, you've got this π
π¦
π¦ where this page comes from
- ubuntu stonking: samba-common-bin 2:4.24.7+dfsg-1ubuntu1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms