1SMBPASSWD(8) System Administration tools SMBPASSWD(8)
2
3
4
6 smbpasswd - change a user's SMB password
7
9 smbpasswd [-a] [-c <config file>] [-x] [-d] [-e] [-D debuglevel] [-n]
10 [-r <remote machine>] [-R <name resolve order>] [-m]
11 [-U username[%password]] [-h] [-s] [-w pass] [-W] [-i] [-L] [username]
12
14 This tool is part of the samba(7) suite.
15
16 The smbpasswd program has several different functions, depending on
17 whether it is run by the root user or not. When run as a normal user it
18 allows the user to change the password used for their SMB sessions on
19 any machines that store SMB passwords.
20
21 By default (when run with no arguments) it will attempt to change the
22 current user's SMB password on the local machine. This is similar to
23 the way the passwd(1) program works. smbpasswd differs from how the
24 passwd program works however in that it is not setuid root but works in
25 a client-server mode and communicates with a locally running smbd(8).
26 As a consequence in order for this to succeed the smbd daemon must be
27 running on the local machine. On a UNIX machine the encrypted SMB
28 passwords are usually stored in the default passdb backend.
29
30 When run by an ordinary user with no options, smbpasswd will prompt
31 them for their old SMB password and then ask them for their new
32 password twice, to ensure that the new password was typed correctly. No
33 passwords will be echoed on the screen whilst being typed. If you have
34 a blank SMB password (specified by the string "NO PASSWORD" in the
35 smbpasswd file) then just press the <Enter> key when asked for your old
36 password.
37
38 smbpasswd can also be used by a normal user to change their SMB
39 password on remote machines, such as Windows NT Primary Domain
40 Controllers. See the (-r) and -U options below.
41
42 When run by root, smbpasswd allows new users to be added and deleted in
43 the smbpasswd file, as well as allows changes to the attributes of the
44 user in this file to be made. When run by root, smbpasswd accesses the
45 local smbpasswd file directly, thus enabling changes to be made even if
46 smbd is not running.
47
49 -a
50 This option specifies that the username following should be added
51 to the local smbpasswd file, with the new password typed (type
52 <Enter> for the old password). This option is ignored if the
53 username following already exists in the smbpasswd file and it is
54 treated like a regular change password command. Note that the
55 default passdb backends require the user to already exist in the
56 system password file (usually /etc/passwd), else the request to add
57 the user will fail.
58
59 This option is only available when running smbpasswd as root.
60
61 -c
62 This option can be used to specify the path and file name of the
63 /etc/samba/smb.conf configuration file when it is important to use
64 other than the default file and / or location.
65
66 -x
67 This option specifies that the username following should be deleted
68 from the local smbpasswd file.
69
70 This option is only available when running smbpasswd as root.
71
72 -d
73 This option specifies that the username following should be
74 disabled in the local smbpasswd file. This is done by writing a 'D'
75 flag into the account control space in the smbpasswd file. Once
76 this is done all attempts to authenticate via SMB using this
77 username will fail.
78
79 If the smbpasswd file is in the 'old' format (pre-Samba 2.0 format)
80 there is no space in the user's password entry to write this
81 information and the command will FAIL. See smbpasswd(5) for details
82 on the 'old' and new password file formats.
83
84 This option is only available when running smbpasswd as root.
85
86 -e
87 This option specifies that the username following should be enabled
88 in the local smbpasswd file, if the account was previously
89 disabled. If the account was not disabled this option has no
90 effect. Once the account is enabled then the user will be able to
91 authenticate via SMB once again.
92
93 If the smbpasswd file is in the 'old' format, then smbpasswd will
94 FAIL to enable the account. See smbpasswd(5) for details on the
95 'old' and new password file formats.
96
97 This option is only available when running smbpasswd as root.
98
99 -D debuglevel
100 debuglevel is an integer from 0 to 10. The default value if this
101 parameter is not specified is zero.
102
103 The higher this value, the more detail will be logged to the log
104 files about the activities of smbpasswd. At level 0, only critical
105 errors and serious warnings will be logged.
106
107 Levels above 1 will generate considerable amounts of log data, and
108 should only be used when investigating a problem. Levels above 3
109 are designed for use only by developers and generate HUGE amounts
110 of log data, most of which is extremely cryptic.
111
112 -n
113 This option specifies that the username following should have their
114 password set to null (i.e. a blank password) in the local smbpasswd
115 file. This is done by writing the string "NO PASSWORD" as the first
116 part of the first password stored in the smbpasswd file.
117
118 Note that to allow users to logon to a Samba server once the
119 password has been set to "NO PASSWORD" in the smbpasswd file the
120 administrator must set the following parameter in the [global]
121 section of the smb.conf file :
122
123 null passwords = yes
124
125 This option is only available when running smbpasswd as root.
126
127 -r remote machine name
128 This option allows a user to specify what machine they wish to
129 change their password on. Without this parameter smbpasswd defaults
130 to the local host. The remote machine name is the NetBIOS name of
131 the SMB/CIFS server to contact to attempt the password change. This
132 name is resolved into an IP address using the standard name
133 resolution mechanism in all programs of the Samba suite. See the -R
134 name resolve order parameter for details on changing this resolving
135 mechanism.
136
137 The username whose password is changed is that of the current UNIX
138 logged on user. See the -U username parameter for details on
139 changing the password for a different username.
140
141 Note that if changing a Windows NT Domain password the remote
142 machine specified must be the Primary Domain Controller for the
143 domain (Backup Domain Controllers only have a read-only copy of the
144 user account database and will not allow the password change).
145
146 Note that Windows 95/98 do not have a real password database so it
147 is not possible to change passwords specifying a Win95/98 machine
148 as remote machine target.
149
150 -R name resolve order
151 This option allows the user of smbpasswd to determine what name
152 resolution services to use when looking up the NetBIOS name of the
153 host being connected to.
154
155 The options are :"lmhosts", "host", "wins" and "bcast". They cause
156 names to be resolved as follows:
157
158 • lmhosts: Lookup an IP address in the Samba lmhosts file.
159 If the line in lmhosts has no name type attached to the
160 NetBIOS name (see the lmhosts(5) for details) then any
161 name type matches for lookup.
162
163 • host: Do a standard host name to IP address resolution,
164 using the system /etc/hosts, NIS, or DNS lookups. This
165 method of name resolution is operating system depended
166 for instance on IRIX or Solaris this may be controlled
167 by the /etc/nsswitch.conf file). Note that this method
168 is only used if the NetBIOS name type being queried is
169 the 0x20 (server) name type, otherwise it is ignored.
170
171 • wins: Query a name with the IP address listed in the
172 wins server parameter. If no WINS server has been
173 specified this method will be ignored.
174
175 • bcast: Do a broadcast on each of the known local
176 interfaces listed in the interfaces parameter. This is
177 the least reliable of the name resolution methods as it
178 depends on the target host being on a locally connected
179 subnet.
180
181 The default order is lmhosts, host, wins, bcast and without this
182 parameter or any entry in the smb.conf(5) file the name resolution
183 methods will be attempted in this order.
184
185 -m
186 This option tells smbpasswd that the account being changed is a
187 MACHINE account. Currently this is used when Samba is being used as
188 an NT Primary Domain Controller.
189
190 This option is only available when running smbpasswd as root.
191
192 -U username
193 This option may only be used in conjunction with the -r option.
194 When changing a password on a remote machine it allows the user to
195 specify the user name on that machine whose password will be
196 changed. It is present to allow users who have different user names
197 on different systems to change these passwords.
198
199 -h
200 This option prints the help string for smbpasswd, selecting the
201 correct one for running as root or as an ordinary user.
202
203 -s
204 This option causes smbpasswd to be silent (i.e. not issue prompts)
205 and to read its old and new passwords from standard input, rather
206 than from /dev/tty (like the passwd(1) program does). This option
207 is to aid people writing scripts to drive smbpasswd
208
209 -w password
210 This parameter is only available if Samba has been compiled with
211 LDAP support. The -w switch is used to specify the password to be
212 used with the ldap admin dn. Note that the password is stored in
213 the secrets.tdb and is keyed off of the admin's DN. This means that
214 if the value of ldap admin dn ever changes, the password will need
215 to be manually updated as well.
216
217 -W
218 NOTE: This option is same as "-w" except that the password should
219 be entered using stdin.
220
221 This parameter is only available if Samba has been compiled with
222 LDAP support. The -W switch is used to specify the password to be
223 used with the ldap admin dn. Note that the password is stored in
224 the secrets.tdb and is keyed off of the admin's DN. This means that
225 if the value of ldap admin dn ever changes, the password will need
226 to be manually updated as well.
227
228 -i
229 This option tells smbpasswd that the account being changed is an
230 interdomain trust account. Currently this is used when Samba is
231 being used as an NT Primary Domain Controller. The account contains
232 the info about another trusted domain.
233
234 This option is only available when running smbpasswd as root.
235
236 -L
237 Run in local mode.
238
239 username
240 This specifies the username for all of the root only options to
241 operate on. Only root can specify this parameter as only root has
242 the permission needed to modify attributes directly in the local
243 smbpasswd file.
244
246 Since smbpasswd works in client-server mode communicating with a local
247 smbd for a non-root user then the smbd daemon must be running for this
248 to work. A common problem is to add a restriction to the hosts that may
249 access the smbd running on the local machine by specifying either allow
250 hosts or deny hosts entry in the smb.conf(5) file and neglecting to
251 allow "localhost" access to the smbd.
252
253 In addition, the smbpasswd command is only useful if Samba has been set
254 up to use encrypted passwords.
255
257 This man page is part of version 4.17.5 of the Samba suite.
258
260 smbpasswd(5), Samba(7).
261
263 The original Samba software and related utilities were created by
264 Andrew Tridgell. Samba is now developed by the Samba Team as an Open
265 Source project similar to the way the Linux kernel is developed.
266
267
268
269Samba 4.17.5 01/26/2023 SMBPASSWD(8)