Debian Codegraph @

upstream/debian-unstable/man8/smbpasswd.8

raw
1 '\" t
2 .\" Title: smbpasswd
3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 05/26/2026
6 .\" Manual: System Administration tools
7 .\" Source: Samba 4.24.3-Debian-4.24.3+dfsg-1
8 .\" Language: English
9 .\"
10 .TH "SMBPASSWD" "8" "05/26/2026" "Samba 4\&.24\&.3\-Debian\-4\&.24\&.3+dfs" "System Administration tools"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 smbpasswd \- change a user\*(Aqs SMB password
32 .SH "SYNOPSIS"
33 .HP \w'\ 'u
34 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]
35 .SH "DESCRIPTION"
36 .PP
37 This tool is part of the
38 \fBsamba\fR(7)
39 suite\&.
40 .PP
41 The smbpasswd program has several different functions, depending on whether it is run by the
42 \fIroot\fR
43 user or not\&. When run as a normal user it allows the user to change the password used for their SMB sessions on any machines that store SMB passwords\&.
44 .PP
45 By default (when run with no arguments) it will attempt to change the current user\*(Aqs SMB password on the local machine\&. This is similar to the way the
46 passwd(1)
47 program works\&.
48 smbpasswd
49 differs from how the passwd program works however in that it is not
50 \fIsetuid root\fR
51 but works in a client\-server mode and communicates with a locally running
52 \fBsmbd\fR(8)\&. As a consequence in order for this to succeed the smbd daemon must be running on the local machine\&. On a UNIX machine the encrypted SMB passwords are usually stored in the default passdb backend\&.
53 .PP
54 When run by an ordinary user with no options, smbpasswd will prompt them for their old SMB password and then ask them for their new password twice, to ensure that the new password was typed correctly\&. No passwords will be echoed on the screen whilst being typed\&. If you have a blank SMB password (specified by the string "NO PASSWORD" in the smbpasswd file) then just press the <Enter> key when asked for your old password\&.
55 .PP
56 smbpasswd can also be used by a normal user to change their SMB password on remote machines, such as Windows NT Primary Domain Controllers\&. See the (\fI\-r\fR) and
57 \fI\-U\fR
58 options below\&.
59 .PP
60 When run by root, smbpasswd allows new users to be added and deleted in the smbpasswd file, as well as allows changes to the attributes of the user in this file to be made\&. When run by root,
61 smbpasswd
62 accesses the local smbpasswd file directly, thus enabling changes to be made even if smbd is not running\&.
63 .SH "OPTIONS"
64 .PP
65 \-a
66 .RS 4
67 This option specifies that the username following should be added to the local smbpasswd file, with the new password typed (type <Enter> for the old password)\&. This option is ignored if the username following already exists in the smbpasswd file and it is treated like a regular change password command\&. Note that the default passdb backends require the user to already exist in the system password file (usually
68 /etc/passwd), else the request to add the user will fail\&.
69 .sp
70 This option is only available when running smbpasswd as root\&.
71 .RE
72 .PP
73 \-c
74 .RS 4
75 This option can be used to specify the path and file name of the
76 /etc/samba/smb\&.conf
77 configuration file when it is important to use other than the default file and / or location\&.
78 .RE
79 .PP
80 \-x
81 .RS 4
82 This option specifies that the username following should be deleted from the local smbpasswd file\&.
83 .sp
84 This option is only available when running smbpasswd as root\&.
85 .RE
86 .PP
87 \-d
88 .RS 4
89 This option specifies that the username following should be
90 \fBdisabled\fR
91 in the local smbpasswd file\&. This is done by writing a
92 \fB\*(AqD\*(Aq\fR
93 flag into the account control space in the smbpasswd file\&. Once this is done all attempts to authenticate via SMB using this username will fail\&.
94 .sp
95 If the smbpasswd file is in the \*(Aqold\*(Aq format (pre\-Samba 2\&.0 format) there is no space in the user\*(Aqs password entry to write this information and the command will FAIL\&. See
96 \fBsmbpasswd\fR(5)
97 for details on the \*(Aqold\*(Aq and new password file formats\&.
98 .sp
99 This option is only available when running smbpasswd as root\&.
100 .RE
101 .PP
102 \-e
103 .RS 4
104 This option specifies that the username following should be
105 \fBenabled\fR
106 in the local smbpasswd file, if the account was previously disabled\&. If the account was not disabled this option has no effect\&. Once the account is enabled then the user will be able to authenticate via SMB once again\&.
107 .sp
108 If the smbpasswd file is in the \*(Aqold\*(Aq format, then
109 smbpasswd
110 will FAIL to enable the account\&. See
111 \fBsmbpasswd\fR(5)
112 for details on the \*(Aqold\*(Aq and new password file formats\&.
113 .sp
114 This option is only available when running smbpasswd as root\&.
115 .RE
116 .PP
117 \-D debuglevel
118 .RS 4
119 \fIdebuglevel\fR
120 is an integer from 0 to 10\&. The default value if this parameter is not specified is zero\&.
121 .sp
122 The higher this value, the more detail will be logged to the log files about the activities of smbpasswd\&. At level 0, only critical errors and serious warnings will be logged\&.
123 .sp
124 Levels above 1 will generate considerable amounts of log data, and should only be used when 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\&.
125 .RE
126 .PP
127 \-n
128 .RS 4
129 This option specifies that the username following 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\&.
130 .sp
131 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
132 smb\&.conf
133 file :
134 .sp
135 null passwords = yes
136 .sp
137 This option is only available when running smbpasswd as root\&.
138 .RE
139 .PP
140 \-r remote machine name
141 .RS 4
142 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
143 \fIremote machine name\fR
144 is the NetBIOS name of the SMB/CIFS server to contact to attempt the password change\&. This name is resolved into an IP address using the standard name resolution mechanism in all programs of the Samba suite\&. See the
145 \fI\-R name resolve order\fR
146 parameter for details on changing this resolving mechanism\&.
147 .sp
148 The username whose password is changed is that of the current UNIX logged on user\&. See the
149 \fI\-U username\fR
150 parameter for details on changing the password for a different username\&.
151 .sp
152 Note that if 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)\&.
153 .sp
154 \fINote\fR
155 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 remote machine target\&.
156 .RE
157 .PP
158 \-R name resolve order
159 .RS 4
160 This option allows the user of smbpasswd to determine what name resolution services to use when looking up the NetBIOS name of the host being connected to\&.
161 .sp
162 The options are :"lmhosts", "host", "wins" and "bcast"\&. They cause names to be resolved as follows:
163 .RS
164 .sp
165 .RS 4
166 .ie n \{\
167 \h'-04'\(bu\h'+03'\c
168 .\}
169 .el \{\
170 .sp -1
171 .IP \(bu 2.3
172 .\}
173 \fBlmhosts\fR: Lookup an IP address in the Samba lmhosts file\&. If the line in lmhosts has no name type attached to the NetBIOS name (see the
174 \fBlmhosts\fR(5)
175 for details) then any name type matches for lookup\&.
176 .RE
177 .sp
178 .RS 4
179 .ie n \{\
180 \h'-04'\(bu\h'+03'\c
181 .\}
182 .el \{\
183 .sp -1
184 .IP \(bu 2.3
185 .\}
186 \fBhost\fR: Do a standard host name to IP address resolution, using the system
187 /etc/hosts, NIS, or DNS lookups\&. This method of name resolution is operating system depended for instance on IRIX or Solaris this may be controlled by the
188 /etc/nsswitch\&.conf
189 file)\&. Note that this method is only used if the NetBIOS name type being queried is the 0x20 (server) name type, otherwise it is ignored\&.
190 .RE
191 .sp
192 .RS 4
193 .ie n \{\
194 \h'-04'\(bu\h'+03'\c
195 .\}
196 .el \{\
197 .sp -1
198 .IP \(bu 2.3
199 .\}
200 \fBwins\fR: Query a name with the IP address listed in the
201 \fIwins server\fR
202 parameter\&. If no WINS server has been specified this method will be ignored\&.
203 .RE
204 .sp
205 .RS 4
206 .ie n \{\
207 \h'-04'\(bu\h'+03'\c
208 .\}
209 .el \{\
210 .sp -1
211 .IP \(bu 2.3
212 .\}
213 \fBbcast\fR: Do a broadcast on each of the known local interfaces listed in the
214 \fIinterfaces\fR
215 parameter\&. This is the least reliable of the name resolution methods as it depends on the target host being on a locally connected subnet\&.
216 .RE
217 .sp
218 .RE
219 The default order is
220 lmhosts, host, wins, bcast
221 and without this parameter or any entry in the
222 \fBsmb.conf\fR(5)
223 file the name resolution methods will be attempted in this order\&.
224 .RE
225 .PP
226 \-m
227 .RS 4
228 This option tells smbpasswd that the account being changed is a MACHINE account\&. Currently this is used when Samba is being used as an NT Primary Domain Controller\&.
229 .sp
230 This option is only available when running smbpasswd as root\&.
231 .RE
232 .PP
233 \-U username
234 .RS 4
235 This option may only be used in conjunction with the
236 \fI\-r\fR
237 option\&. 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 is present to allow users who have different user names on different systems to change these passwords\&.
238 .RE
239 .PP
240 \-h
241 .RS 4
242 This option prints the help string for
243 smbpasswd, selecting the correct one for running as root or as an ordinary user\&.
244 .RE
245 .PP
246 \-s
247 .RS 4
248 This option causes smbpasswd to be silent (i\&.e\&. not issue prompts) and to read its old and new passwords from standard input, rather than from
249 /dev/tty
250 (like the
251 passwd(1)
252 program does)\&. This option is to aid people writing scripts to drive smbpasswd
253 .RE
254 .PP
255 \-w password
256 .RS 4
257 This parameter is only available if Samba has been compiled with LDAP support\&. The
258 \fI\-w\fR
259 switch is used to specify the password to be used with the
260 \m[blue]\fBldap admin dn\fR\m[]\&. Note that the password is stored in the
261 secrets\&.tdb
262 and is keyed off of the admin\*(Aqs DN\&. This means that if the value of
263 \fIldap admin dn\fR
264 ever changes, the password will need to be manually updated as well\&.
265 .RE
266 .PP
267 \-W
268 .RS 4
269 NOTE:
270 This option is same as "\-w" except that the password should be entered using stdin\&.
271 .sp
272 This parameter is only available if Samba has been compiled with LDAP support\&. The
273 \fI\-W\fR
274 switch is used to specify the password to be used with the
275 \m[blue]\fBldap admin dn\fR\m[]\&. Note that the password is stored in the
276 secrets\&.tdb
277 and is keyed off of the admin\*(Aqs DN\&. This means that if the value of
278 \fIldap admin dn\fR
279 ever changes, the password will need to be manually updated as well\&.
280 .RE
281 .PP
282 \-i
283 .RS 4
284 This option tells smbpasswd that 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\&.
285 .sp
286 This option is only available when running smbpasswd as root\&.
287 .RE
288 .PP
289 \-L
290 .RS 4
291 Run in local mode\&.
292 .RE
293 .PP
294 username
295 .RS 4
296 This specifies the username for all of the
297 \fIroot only\fR
298 options to operate on\&. Only root can specify this parameter as only root has the permission needed to modify attributes directly in the local smbpasswd file\&.
299 .RE
300 .SH "NOTES"
301 .PP
302 Since
303 smbpasswd
304 works in client\-server mode communicating with a local smbd for a non\-root user then the smbd daemon must be running for this to work\&. A common problem is to add a restriction to the hosts that may access the
305 smbd
306 running on the local machine by specifying either
307 \fIallow hosts\fR
308 or
309 \fIdeny hosts\fR
310 entry in the
311 \fBsmb.conf\fR(5)
312 file and neglecting to allow "localhost" access to the smbd\&.
313 .PP
314 In addition, the smbpasswd command is only useful if Samba has been set up to use encrypted passwords\&.
315 .SH "VERSION"
316 .PP
317 This man page is part of version 4\&.24\&.3\-Debian\-4\&.24\&.3+dfsg\-1 of the Samba suite\&.
318 .SH "SEE ALSO"
319 .PP
320 \fBsmbpasswd\fR(5),
321 \fBSamba\fR(7)\&.
322 .SH "AUTHOR"
323 .PP
324 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\&.