7f7783425a31221eb23d0218e7ea92b04b7eacf7
[samba.git] / docs / docbook / manpages / smbpasswd.8.sgml
1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
2 <refentry id="smbpasswd">
3
4 <refmeta>
5         <refentrytitle>smbpasswd</refentrytitle>
6         <manvolnum>8</manvolnum>
7 </refmeta>
8
9
10 <refnamediv>
11         <refname>smbpasswd</refname>
12         <refpurpose>change a users SMB password</refpurpose>
13 </refnamediv>
14
15 <refsynopsisdiv>
16         <cmdsynopsis>
17                 <command>smbpasswd</command>
18                 <arg choice="opt">-a</arg>      
19                 <arg choice="opt">-x</arg>      
20                 <arg choice="opt">-d</arg>      
21                 <arg choice="opt">-e</arg>      
22                 <arg choice="opt">-D debuglevel</arg>   
23                 <arg choice="opt">-n</arg>      
24                 <arg choice="opt">-r &lt;remote machine&gt;</arg>       
25                 <arg choice="opt">-R &lt;name resolve order&gt;</arg>   
26                 <arg choice="opt">-m</arg>      
27                 <arg choice="opt">-j DOMAIN</arg>       
28                 <arg choice="opt">-U username</arg>     
29                 <arg choice="opt">-h</arg>      
30                 <arg choice="opt">-s</arg>      
31                 <arg choice="opt">username</arg>        
32         </cmdsynopsis>
33 </refsynopsisdiv>
34
35 <refsect1>
36         <title>DESCRIPTION</title>
37
38         <para>This tool is part of the <ulink url="samba.7.html">
39         Samba</ulink> suite.</para>
40         
41         <para>The smbpasswd program has several different 
42         functions, depending on whether it is run by the <emphasis>root</emphasis> 
43         user or not. When run as a normal user it allows the user to change 
44         the password used for their SMB sessions on any machines that store 
45         SMB passwords. </para>
46
47         <para>By default (when run with no arguments) it will attempt to 
48         change the current users SMB password on the local machine. This is 
49         similar to the way the <command>passwd(1)</command> program works. 
50         <command>smbpasswd</command> differs from how the passwd program works 
51         however in that it is not <emphasis>setuid root</emphasis> but works in 
52         a client-server mode and communicates with a locally running
53         <command>smbd(8)</command>. As a consequence in order for this to 
54         succeed the smbd daemon must be running on the local machine. On a 
55         UNIX machine the encrypted SMB passwords are usually stored in 
56         the <filename>smbpasswd(5)</filename> file. </para>
57
58         <para>When run by an ordinary user with no options. smbpasswd 
59         will prompt them for their old smb password and then ask them 
60         for their new password twice, to ensure that the new password
61         was typed correctly. No passwords will be echoed on the screen 
62         whilst being typed. If you have a blank smb password (specified by 
63         the string "NO PASSWORD" in the smbpasswd file) then just press 
64         the &lt;Enter&gt; key when asked for your old password. </para>
65
66         <para>smbpasswd can also be used by a normal user to change their
67         SMB password on remote machines, such as Windows NT Primary Domain 
68         Controllers.   See the (-r) and -U options below. </para>
69
70         <para>When run by root, smbpasswd allows new users to be added 
71         and deleted in the smbpasswd file, as well as allows changes to 
72         the attributes of the user in this file to be made. When run by root, 
73         <command>smbpasswd</command> accesses the local smbpasswd file 
74         directly, thus enabling changes to be made even if smbd is not 
75         running. </para>
76 </refsect1>
77
78 <refsect1>
79         <title>OPTIONS</title>
80         <variablelist>
81                 <varlistentry>
82                 <term>-a</term>
83                 <listitem><para>This option specifies that the username 
84                 following should be added to the local smbpasswd file, with the 
85                 new password typed (type &lt;Enter&gt; for the old password). This 
86                 option is ignored if the username following already exists in 
87                 the smbpasswd file and it is treated like a regular change 
88                 password command. Note that the user to be added must already exist 
89                 in the system password file (usually <filename>/etc/passwd</filename>)
90                 else the request to add the user will fail. </para>
91                 
92                 <para>This option is only available when running smbpasswd 
93                 as root. </para></listitem>
94                 </varlistentry>
95                 
96                 
97                 
98                 <varlistentry>
99                 <term>-x</term>
100                 <listitem><para>This option specifies that the username 
101                 following should be deleted from the local smbpasswd file.
102                 </para>
103
104                 <para>This option is only available when running smbpasswd as 
105                 root.</para></listitem>
106                 </varlistentry>
107                 
108                 
109                 
110                 <varlistentry>
111                 <term>-d</term>
112                 <listitem><para>This option specifies that the username following 
113                 should be <constant>disabled</constant> in the local smbpasswd 
114                 file. This is done by writing a <constant>'D'</constant> flag 
115                 into the account control space in the smbpasswd file. Once this 
116                 is done all attempts to authenticate via SMB using this username 
117                 will fail. </para>
118                 
119                 <para>If the smbpasswd file is in the 'old' format (pre-Samba 2.0 
120                 format) there is no space in the users password entry to write
121                 this information and so the user is disabled by writing 'X' characters 
122                 into the password space in the smbpasswd file. See <command>smbpasswd(5)
123                 </command> for details on the 'old' and new password file formats.
124                 </para>
125
126                 <para>This option is only available when running smbpasswd as 
127                 root.</para></listitem>
128                 </varlistentry>
129                 
130                 
131                 <varlistentry>
132                 <term>-e</term>
133                 <listitem><para>This option specifies that the username following 
134                 should be <constant>enabled</constant> in the local smbpasswd file, 
135                 if the account was previously disabled. If the account was not 
136                 disabled this option has no effect. Once the account is enabled then 
137                 the user will be able to authenticate via SMB once again. </para>
138                 
139                 <para>If the smbpasswd file is in the 'old' format, then <command>
140                 smbpasswd</command> will prompt for a new password for this user, 
141                 otherwise the account will be enabled by removing the <constant>'D'
142                 </constant> flag from account control space in the <filename>
143                 smbpasswd</filename> file. See <command>smbpasswd (5)</command> for 
144                 details on the 'old' and new password file formats. </para>
145
146                 <para>This option is only available when running smbpasswd as root. 
147                 </para></listitem>
148                 </varlistentry>
149                 
150
151
152                 <varlistentry>
153                 <term>-D debuglevel</term>
154                 <listitem><para><parameter>debuglevel</parameter> is an integer 
155                 from 0 to 10.  The default value if this parameter is not specified 
156                 is zero. </para>
157
158                 <para>The higher this value, the more detail will be logged to the 
159                 log files about the activities of smbpasswd. At level 0, only 
160                 critical errors and serious warnings will be logged. </para>
161
162                 <para>Levels above 1 will generate considerable amounts of log 
163                 data, and should only be used when investigating a problem. Levels 
164                 above 3 are designed for use only by developers and generate
165                 HUGE amounts of log data, most of which is extremely cryptic. 
166                 </para></listitem>
167                 </varlistentry>
168                 
169                 
170                 
171                 <varlistentry>
172                 <term>-n</term>
173                 <listitem><para>This option specifies that the username following 
174                 should have their password set to null (i.e. a blank password) in 
175                 the local smbpasswd file. This is done by writing the string "NO 
176                 PASSWORD" as the first part of the first password stored in the 
177                 smbpasswd file. </para>
178
179                 <para>Note that to allow users to logon to a Samba server once 
180                 the password has been set to "NO PASSWORD" in the smbpasswd
181                 file the administrator must set the following parameter in the [global]
182                 section of the <filename>smb.conf</filename> file : </para>
183                 
184                 <para><command>null passwords = yes</command></para> 
185                 
186                 <para>This option is only available when running smbpasswd as 
187                 root.</para></listitem>
188                 </varlistentry>
189                 
190                 
191                 
192                 <varlistentry>
193                 <term>-r remote machine name</term>
194                 <listitem><para>This option allows a user to specify what machine 
195                 they wish to change their password on. Without this parameter 
196                 smbpasswd defaults to the local host. The <replaceable>remote 
197                 machine name</replaceable> is the NetBIOS name of the SMB/CIFS 
198                 server to contact to attempt the password change. This name is 
199                 resolved into an IP address using the standard name resolution 
200                 mechanism in all programs of the Samba suite. See the <parameter>-R 
201                 name resolve order</parameter> parameter for details on changing 
202                 this resolving mechanism. </para>
203
204                 <para>The username whose password is changed is that of the 
205                 current UNIX logged on user. See the <parameter>-U username</parameter>
206                 parameter for details on changing the password for a different 
207                 username. </para>
208
209                 <para>Note that if changing a Windows NT Domain password the 
210                 remote machine specified must be the Primary Domain Controller for 
211                 the domain (Backup Domain Controllers only have a read-only
212                 copy of the user account database and will not allow the password 
213                 change).</para>
214                 
215                 <para><emphasis>Note</emphasis> that Windows 95/98 do not have 
216                 a real password database so it is not possible to change passwords 
217                 specifying a Win95/98  machine as remote machine target. </para>
218                 </listitem>
219                 </varlistentry>
220                 
221                 
222                 <varlistentry>
223                 <term>-R name resolve order</term>
224                 <listitem><para>This option allows the user of smbclient to determine 
225                 what name resolution services to use when looking up the NetBIOS
226                 name of the host being connected to. </para>
227
228                 <para>The options are :"lmhosts", "host", "wins" and "bcast". They cause 
229                 names to be resolved as follows : </para>
230                         <itemizedlist>
231                                 <listitem><para><constant>lmhosts</constant> : Lookup an IP 
232             address in the Samba lmhosts file. If the line in lmhosts has 
233             no name type attached to the NetBIOS name (see the <ulink 
234             url="lmhosts.5.html">lmhosts(5)</ulink> for details) then
235             any name type matches for lookup.</para></listitem>
236
237             <listitem><para><constant>host</constant> : Do a standard host 
238             name to IP address resolution, using the system <filename>/etc/hosts
239             </filename>, NIS, or DNS lookups. This method of name resolution 
240             is operating system depended for instance on IRIX or Solaris this 
241             may be controlled by the <filename>/etc/nsswitch.conf</filename> 
242             file).  Note that this method is only used if the NetBIOS name 
243             type being queried is the 0x20 (server) name type, otherwise 
244             it is ignored.</para></listitem>
245
246             <listitem><para><constant>wins</constant> : Query a name with 
247             the IP address listed in the <parameter>wins server</parameter> 
248                                 parameter.  If no WINS server has been specified this method 
249                                 will be ignored.</para></listitem>
250
251             <listitem><para><constant>bcast</constant> : Do a broadcast on 
252             each of the known local interfaces listed in the
253             <parameter>interfaces</parameter> parameter. This is the least 
254                                 reliable of the name resolution methods as it depends on the 
255                                 target host being on a locally connected subnet.</para></listitem>
256                 </itemizedlist>
257                 
258                 <para>The default order is <command>lmhosts, host, wins, bcast</command> 
259                 and without this parameter or any entry in the 
260                 <filename>smb.conf</filename> file the name resolution methods will 
261                 be attempted in this order. </para></listitem>
262                 </varlistentry>
263                 
264                 
265                 <varlistentry>
266                 <term>-m</term>
267                 <listitem><para>This option tells smbpasswd that the account 
268                 being changed is a MACHINE account. Currently this is used 
269                 when Samba is being used as an NT Primary Domain Controller.</para>
270
271                 <para>This option is only available when running smbpasswd as root.     
272                 </para></listitem>
273                 </varlistentry>
274                 
275                 
276                 <varlistentry>
277                 <term>-j DOMAIN</term>
278                 <listitem><para>This option is used to add a Samba server 
279                 into a Windows NT Domain, as a Domain member capable of authenticating 
280                 user accounts to any Domain Controller in the same way as a Windows 
281                 NT Server. See the <command>security = domain</command> option in 
282                 the <filename>smb.conf(5)</filename> man page. </para>
283                 
284                 <para>In order to be used in this way, the Administrator for 
285                 the Windows NT Domain must have used the program "Server Manager 
286                 for Domains" to add the primary NetBIOS name of  the Samba server 
287                 as a member of the Domain. </para>
288                 
289                 <para>After this has been done, to join the Domain invoke <command>
290                 smbpasswd</command> with this parameter. smbpasswd will then 
291                 look up the Primary Domain Controller for the Domain (found in 
292                 the <filename>smb.conf</filename> file in the parameter 
293                 <parameter>password server</parameter> and change the machine account 
294                 password used to create the secure Domain communication.  This 
295                 password is then stored by smbpasswd in a TDB, writeable only by root, 
296                 called <filename>secrets.tdb</filename> </para>
297                 
298                 <para>Once this operation has been performed the <filename>
299                 smb.conf</filename> file may be updated to set the <command>
300                 security = domain</command> option and all future logins
301                 to the Samba server will be authenticated to the Windows NT 
302                 PDC. </para>
303                 
304                 <para>Note that even though the authentication is being 
305                 done to the PDC all users accessing the Samba server must still 
306                 have a valid UNIX account on that machine. </para>
307
308
309                 <para>This option is only available when running smbpasswd as root. 
310                 </para></listitem>
311                 </varlistentry>
312                 
313                 
314                 
315                 <varlistentry>
316                 <term>-U username</term>
317                 <listitem><para>This option may only be used in conjunction 
318                 with the <parameter>-r</parameter> option. When changing
319                 a password on a remote machine it allows the user to specify 
320                 the user name on that machine whose password will be changed. It 
321                 is present to allow users who have different user names on 
322                 different systems to change these passwords. </para></listitem>
323                 </varlistentry>
324                 
325                 
326                 <varlistentry>
327                 <term>-h</term>
328                 <listitem><para>This option prints the help string for <command>
329                 smbpasswd</command>, selecting the correct one for running as root 
330                 or as an ordinary user. </para></listitem>
331                 </varlistentry>
332                 
333                 
334                 
335                 <varlistentry>
336                 <term>-s</term>
337                 <listitem><para>This option causes smbpasswd to be silent (i.e. 
338                 not issue prompts) and to read it's old and new passwords from 
339                 standard  input, rather than from <filename>/dev/tty</filename> 
340                 (like the <command>passwd(1)</command> program does). This option 
341                 is to aid people writing scripts to drive smbpasswd</para>
342                 </listitem>
343                 </varlistentry>
344                 
345                 
346                 
347                 <varlistentry>
348                 <term>username</term>
349                 <listitem><para>This specifies the username for all of the 
350                 <emphasis>root only</emphasis> options to operate on. Only root 
351                 can specify this parameter as only root has the permission needed 
352                 to modify attributes directly in the local smbpasswd file. 
353                 </para></listitem>
354                 </varlistentry>
355         </variablelist>
356 </refsect1>
357
358
359 <refsect1>
360         <title>NOTES</title>
361         
362         <para>Since <command>smbpasswd</command> works in client-server 
363         mode communicating  with a local smbd for a non-root user then 
364         the smbd daemon must be running for this to work. A common problem 
365         is to add a restriction to the hosts that may access the <command>
366         smbd</command> running on the local machine by specifying a 
367         <parameter>allow hosts</parameter> or <parameter>deny hosts</parameter> 
368         entry in the <filename>smb.conf</filename> file and neglecting to 
369         allow "localhost" access to the smbd. </para>
370
371         <para>In addition, the smbpasswd command is only useful if Samba
372         has been set up to use encrypted passwords. See the file 
373         <filename>ENCRYPTION.txt</filename> in the docs directory for details 
374         on how to do this. </para>
375 </refsect1>
376
377
378 <refsect1>
379         <title>VERSION</title>
380
381         <para>This man page is correct for version 2.2 of 
382         the Samba suite.</para>
383 </refsect1>
384
385 <refsect1>
386         <title>SEE ALSO</title>
387         <para><ulink url="smbpasswd.5.html"><filename>smbpasswd(5)</filename></ulink>, 
388         <ulink url="samba.7.html">samba(7)</ulink>
389         </para>
390 </refsect1>
391
392 <refsect1>
393         <title>AUTHOR</title>
394         
395         <para>The original Samba software and related utilities 
396         were created by Andrew Tridgell. Samba is now developed
397         by the Samba Team as an Open Source project similar 
398         to the way the Linux kernel is developed.</para>
399         
400         <para>The original Samba man pages were written by Karl Auer. 
401         The man page sources were converted to YODL format (another 
402         excellent piece of Open Source software, available at
403         <ulink url="ftp://ftp.icce.rug.nl/pub/unix/">
404         ftp://ftp.icce.rug.nl/pub/unix/</ulink>) and updated for the Samba 2.0 
405         release by Jeremy Allison.  The conversion to DocBook for 
406         Samba 2.2 was done by Gerald Carter</para>
407 </refsect1>
408
409 </refentry>