2004-04-07 14:15:11 +04:00
<samba:parameter name= "username map"
context="G"
2015-05-01 00:32:45 +03:00
type="string"
2005-03-13 01:41:20 +03:00
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
2004-04-07 14:15:11 +04:00
<description >
2005-10-22 04:04:38 +04:00
<para >
This option allows you to specify a file containing a mapping of usernames from the clients to the server.
This can be used for several purposes. The most common is to map usernames that users use on DOS or Windows
machines to those that the UNIX box uses. The other is to map multiple users to a single username so that they
can more easily share files.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
2012-09-04 02:46:06 +04:00
Please note that for user mode security, the username map is applied prior to validating the user
2005-10-22 04:04:38 +04:00
credentials. Domain member servers (domain or ads) apply the username map after the user has been
2012-06-11 22:58:11 +04:00
successfully authenticated by the domain controller and require fully qualified entries in the map table (e.g.
2008-02-14 17:26:48 +03:00
biddle = <literal > DOMAIN\foo</literal> ).
2005-10-22 04:04:38 +04:00
</para>
<para >
The map file is parsed line by line. Each line should contain a single UNIX username on the left then a '='
followed by a list of usernames on the right. The list of usernames on the right may contain names of the form
@group in which case they will match any UNIX username in that group. The special client name '*' is a
wildcard and matches any name. Each line of the map file may be up to 1023 characters long.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
The file is processed on each line by taking the supplied username and comparing it with each username on the
right hand side of the '=' signs. If the supplied name matches any of the names on the right hand side then it
is replaced with the name on the left. Processing then continues with the next line.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
If any line begins with a '#' or a ';' then it is ignored.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
If any line begins with an '!' then the processing will stop after that line if a mapping was done by the
line. Otherwise mapping continues with every line being processed. Using '!' is most useful when you have a
wildcard mapping line later in the file.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
For example to map from the name <constant > admin</constant> or <constant > administrator</constant> to the UNIX
name <constant > root</constant> you would use:
<programlisting >
<command moreinfo= "none" > root = admin administrator</command>
</programlisting>
Or to map anyone in the UNIX group <constant > system</constant> to the UNIX name <constant > sys</constant> you would use:
<programlisting >
<command moreinfo= "none" > sys = @system</command>
</programlisting>
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
You can have as many mappings as you like in a username map file.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
If your system supports the NIS NETGROUP option then the netgroup database is checked before the <filename
moreinfo="none">/etc/group </filename> database for matching groups.
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
You can map Windows usernames that have spaces in them by using double quotes around the name. For example:
<programlisting >
<command moreinfo= "none" > tridge = " Andrew Tridgell" </command>
</programlisting>
would map the windows username " Andrew Tridgell" to the unix username " tridge" .
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
The following example would map mary and fred to the unix user sys, and map the rest to guest. Note the use of the
'!' to tell Samba to stop processing if it gets a match on that line:
<programlisting format= "linespecific" >
2004-04-07 14:15:11 +04:00
!sys = mary fred
guest = *
2005-10-22 04:04:38 +04:00
</programlisting>
</para>
2004-04-07 14:15:11 +04:00
2005-08-25 20:49:40 +04:00
<para >
2005-10-22 04:04:38 +04:00
Note that the remapping is applied to all occurrences of usernames. Thus if you connect to \\server\fred and
<constant > fred</constant> is remapped to <constant > mary</constant> then you will actually be connecting to
\\server\mary and will need to supply a password suitable for <constant > mary</constant> not
2012-09-04 02:46:06 +04:00
<constant > fred</constant> . The only exception to this is the
username passed to a Domain Controller (if you have one). The DC will receive whatever username the client
2005-10-22 04:04:38 +04:00
supplies without modification.
2005-08-25 20:49:40 +04:00
</para>
2004-04-07 14:15:11 +04:00
2005-10-22 04:04:38 +04:00
<para >
Also note that no reverse mapping is done. The main effect this has is with printing. Users who have been
mapped may have trouble deleting print jobs as PrintManager under WfWg will think they don't own the print
job.
</para>
2004-11-08 09:10:13 +03:00
<para >
2008-02-14 17:26:48 +03:00
Samba versions prior to 3.0.8 would only support reading the fully qualified username
(e.g.: <literal > DOMAIN\user</literal> ) from
2005-10-22 04:04:38 +04:00
the username map when performing a kerberos login from a client. However, when looking up a map entry for a
user authenticated by NTLM[SSP], only the login name would be used for matches. This resulted in inconsistent
behavior sometimes even on the same server.
2004-11-08 09:10:13 +03:00
</para>
<para >
The following functionality is obeyed in version 3.0.8 and later:
</para>
<para >
2005-10-22 04:04:38 +04:00
When performing local authentication, the username map is applied to the login name before attempting to authenticate
2004-11-08 09:10:13 +03:00
the connection.
</para>
<para >
2005-10-22 04:04:38 +04:00
When relying upon a external domain controller for validating authentication requests, smbd will apply the username map
2008-02-14 17:26:48 +03:00
to the fully qualified username (i.e. <literal > DOMAIN\user</literal> ) only after the user has been successfully authenticated.
2004-11-08 09:10:13 +03:00
</para>
2005-07-06 08:05:49 +04:00
2005-08-25 20:49:40 +04:00
<para >
An example of use is:
<programlisting >
2005-07-06 08:05:49 +04:00
username map = /usr/local/samba/lib/users.map
2005-08-25 20:49:40 +04:00
</programlisting>
</para>
2005-10-22 04:04:38 +04:00
2004-04-07 14:15:11 +04:00
</description>
<value type= "default" > <comment > no username map</comment> </value>
</samba:parameter>