òÅÐÏÚÉÔÏÒÉÊ Sisyphus
ðÏÓÌÅÄÎÅÅ ÏÂÎÏ×ÌÅÎÉÅ: 1 ÏËÔÑÂÒÑ 2023 | ðÁËÅÔÏ×: 18631 | ðÏÓÅÝÅÎÉÊ: 37887667
en ru br
òÅÐÏÚÉÔÏÒÉÉ ALT
S:0.9.10-alt1
5.1: 0.9.6-alt2.M51.1
4.1: 0.9.4-alt1
4.0: 0.9.2-alt0
3.0: 0.8.5-alt1
www.altlinux.org/Changes

çÒÕÐÐÁ :: óÉÓÔÅÍÁ/îÁÓÔÒÏÊËÁ/óÅÔØ
ðÁËÅÔ: smbldap-tools

 çÌÁ×ÎÁÑ   éÚÍÅÎÅÎÉÑ   óÐÅË   ðÁÔÞÉ   éÓÈÏÄÎÉËÉ   úÁÇÒÕÚÉÔØ   Gear   Bugs and FR  Repocop 

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>

Smbldap-tools User Manual (Release: 0.8.7 )



</title>
<link rel="Index" href="/"/>
<link rel="icon" href="/images/site_icon.png" type="image/png"/>
<link rel="Help" href="/accessibility.en.html"/>
<link rel="stylesheet" type="text/css" href="/style/layout.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="/style/homepage.css" media="screen"/>
<script src="/style/navbar.js" type="text/javascript" charset="iso-8859-1">
//

//
</script>
</head>
<body onload="init()">
<div id="headerBox"><a href="/" accesskey="1"><img src="/images/logo_IDEALX.png" alt="IDEALX S.A.S" width="140" height="65"/></a>
www.idealx.org: IDEALX's contributive site
</div>
<div style="clear: both;"/>
<div id="rightmenu"><div class="menuTopItem"><a href="#content"><img src="/images/skip_to_content.png" alt="Content" width="95" height="9"/></a></div><div class="menuTopItem"><a href="smbldap-tools.fr.html">
<img src="/images/francais_menu.png" alt="French version" width="60" height="9" />
</a></div><div class="menuTopItem"><a href="/"><img src="/images/home.png" alt="Home" width="38" height="9"/></a></div>

<div id="menuSubChap"><a href="/prj/index.en.html" ><img src="/images/menu-icon_up.png" alt="^" width="9" height="9" class="menuIcon"/>Projects</a><div class="menuSubChaps">
<a href="index.en.html" class="menuSubChap">Samba contribs</a><div class="menuSubChapEls">
<a href="http://www.idealx.org/prj/imc/">Samba Console (IMC)</a>
<a href="dist/smbldap-tools-0.9.0.tgz">smbldap-tools</a>
<a href="dist/smbldap-tools.pdf">smbldap-tools Users' manual (PDF)</a>
<a href="smbldap-tools.en.html">smbldap-tools Users' manual (HTML)</a>
<a href="samba-ldap-howto.pdf">Samba2-LDAP PDC Howto (PDF)</a>
<a href="smbldap-howto.en.html">Samba3-LDAP PDC Howto (HTML, CVS version)</a>
<a href="http://cvs.idealx.org/cgi-bin/cvsweb/samba">CVSWeb</a>
<a href="http://lists.idealx.org/lists/samba">Mailing List</a>
<a href="dist/">Download</a>
</div>
</div></div>


</div>
<div id="maincontent"><a id="content"/><h1>

Smbldap-tools User Manual (Release: 0.8.7 )



</h1>






<h3>Jérôme Tournier</h3>
<h3><em>Revision</em>: 1.6 , generated May 25,
2005</h3>
This document is the property of IDEALX<a id="text1"></a>1. Permission is granted to
distribute this document under the terms of the GNU Free
Documentation License (<a href="http://www.gnu.org/copyleft/fdl.html">http://www.gnu.org/copyleft/fdl.html</a>).



<h2>Table of Contents</h2>

<ul>
<li><a href="#htoc1">1  Introduction</a>
<ul>
<li><a href="#htoc2">1.1  Software requirements</a></li>
<li><a href="#htoc3">1.2  Updates of this
document</a></li>
<li><a href="#htoc4">1.3  Availability of this
document</a></li>
</ul>
</li>
<li><a href="#htoc5">2  Installation</a>
<ul>
<li><a href="#htoc6">2.1  Requirements</a></li>
<li><a href="#htoc7">2.2  Installation</a>
<ul>
<li><a href="#htoc8">2.2.1  Installing from rpm</a></li>
<li><a href="#htoc9">2.2.2  Installing from a
tarball</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#htoc10">3  Configuring the
smbldap-tools</a>
<ul>
<li><a href="#htoc11">3.1  The smbldap.conf file</a></li>
<li><a href="#htoc12">3.2  The smbldap_bind.conf
file</a></li>
</ul>
</li>
<li><a href="#htoc13">4  Using the scripts</a>
<ul>
<li><a href="#htoc14">4.1  Initial directory's
population</a></li>
<li><a href="#htoc15">4.2  User management</a>
<ul>
<li><a href="#htoc16">4.2.1  Adding a user</a></li>
<li><a href="#htoc17">4.2.2  Removing a user</a></li>
<li><a href="#htoc18">4.2.3  Modifying a user</a></li>
</ul>
</li>
<li><a href="#htoc19">4.3  Group management</a>
<ul>
<li><a href="#htoc20">4.3.1  Adding a group</a></li>
<li><a href="#htoc21">4.3.2  Removing a group</a></li>
</ul>
</li>
<li><a href="#htoc22">4.4  Adding a interdomain trust
account</a></li>
</ul>
</li>
<li><a href="#htoc23">5  Samba and the smbldap-tools
scripts</a>
<ul>
<li><a href="#htoc24">5.1  General configuration</a></li>
<li><a href="#htoc25">5.2  Migrating an NT4 PDC to
Samba3</a></li>
</ul>
</li>
<li><a href="#htoc26">6  Frequently Asked Questions</a>
<ul>
<li><a href="#htoc27">6.1  How can i use old released
uidNumber and gidNumber ?</a></li>
<li><a href="#htoc28">6.2  I always have this error:
"Can't locate IO/Socket/SSL.pm"</a></li>
<li><a href="#htoc29">6.3  I can't initialize the
directory with smbldap-populate</a></li>
<li><a href="#htoc30">6.4  I can't join the domain with
the root account</a></li>
<li><a href="#htoc31">6.5  I have the
sambaSamAccount but i can't logged in</a></li>
<li><a href="#htoc32">6.6  I want to create machine
account on the fly, but it does not works or I must do it
twice</a></li>
<li><a href="#htoc33">6.7  I can't manage the Oracle
Internet Database</a></li>
<li><a href="#htoc34">6.8  The directive passwd
program = /usr/local/sbin/smbldap-passwd -u %u is not called,
or i got a error message when changing the password from
windows</a></li>
<li><a href="#htoc35">6.9  New computers account can't be
set in ou=computers</a></li>
<li><a href="#htoc36">6.10  I can join the domain, but i
can't log on</a></li>
<li><a href="#htoc37">6.11  I can't create a user with
smbldap-useradd</a></li>
<li><a href="#htoc38">6.12  smbldap-useradd: Can't call
method "get_value" on an undefined value at
/usr/local/sbin/smbldap-useradd line 154</a></li>
<li><a href="#htoc39">6.13  Typical errors on creating a
new user or a new group</a></li>
</ul>
</li>
<li><a href="#htoc40">7  Thanks</a></li>
<li><a href="#htoc41">8  Annexes</a>
<ul>
<li><a href="#htoc42">8.1  Full configuration files</a>
<ul>
<li><a href="#htoc43">8.1.1  The
/etc/opt/IDEALX/smbldap-tools/smbldap.conf file</a></li>
<li><a href="#htoc44">8.1.2  The
/etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf
file</a></li>
<li><a href="#htoc45">8.1.3  The samba configuration file
: /etc/samba/smb.conf</a></li>
<li><a href="#htoc46">8.1.4  The OpenLDAP configuration
file : /etc/openldap/slapd.conf</a></li>
</ul>
</li>
<li><a href="#htoc47">8.2  Changing the administrative
account (ldap admin dn in smb.conf file)</a></li>
<li><a href="#htoc48">8.3  known bugs</a></li>
</ul>
</li>
</ul>

<h2><a id="htoc1"></a>1  Introduction</h2>

<a id="sec:intro"></a> Smbldap-tools is a set of
scripts designed to help integrate Samba and a LDAP directory. They
target both users and administrators of Linux systems.

Users can change their password in a way similar to the standard
``passwd'' command.

Administrators can perform user and group management command line
actions and synchronise Samba account management
consistently.

This document presents:
<ul>
<li>a detailled view of the smbldap-tools scripts</li>
<li>a step by step explanation of how to set up a Samba3 domain
controller</li>
</ul>

<h3><a id="htoc2"></a>1.1  Software
requirements</h3>

The smbldap-tools have been developped and tested with the
following configuration :
<ul>
<li><em>Linux</em> RedHat 9 (be should work
on any <em>Linux</em> distribution)</li>
<li>Samba release 3.0.2pre1,</li>
<li>OpenLDAP release 2.1.22</li>
<li>Microsoft Windows NT 4.0, Windows 2000
and Windows XP Workstations and Servers,</li>
</ul>
This guide applies to smbldap-tools
<em>Release</em>: 0.8.7 .


<h3><a id="htoc3"></a>1.2  Updates of this
document</h3>

The most up to date release of this document may be found on the
smbldap-tools project page available at <a href="http://samba.IDEALX.org/">http://samba.IDEALX.org/</a>.


If you find any bugs in this document, or if you want this document
to integrate some additional infos, please drop us a mail with your
bug report and/or change request at samba@IDEALX.org.


<h3><a id="htoc4"></a>1.3  Availability of
this document</h3>

This document is the property of <strong><em>IDEALX</em></strong> (<a href="http://www.IDEALX.com/">http://www.IDEALX.com/</a>).


Permission is granted to distribute this document under the terms
of the GNU Free Documentation License (See <a href="http://www.gnu.org/copyleft/fdl.html">http://www.gnu.org/copyleft/fdl.html</a>).

<h2><a id="htoc5"></a>2  Installation</h2>


<h3><a id="htoc6"></a>2.1  Requirements</h3>

The main requirement for using smbldap-tools are the two perl
module: Net::LDAP and Crypt::SmbHash. In most cases, you'll also
need the IO-Socket-SSL Perl module to use TLS functionnality.

If you want samba to call the scripts so that you can use the User
Manager (or any other) under MS-Windows (to add, delete modify
users and groups), Samba must be installed
on the same computer. Finally, OpenLDAP can
be installed on any computer. Please check that it can be contacted
by a standard LDAP client software.

Samba and OpenLDAP
installations will not be discussed here. You can consult the howto
also available on the project page (<a href="http://samba.IDEALX.org">http://samba.IDEALX.org</a>).
Altought is has been written for Samba2, most of its content still
apply to Samba3. The main difference stands in LDAP schema's
definitions.


<h3><a id="htoc7"></a>2.2  Installation</h3>

An archive of the smbldap-tools scripts can
be downloaded on our project page <a href="http://samba.IDEALX.org/">http://samba.IDEALX.org/</a>.
Archive and RedHat packages are available.
If you are upgrading, look at the INSTALL file or read the
link <a href="#faq::error::add::user">6.13</a>.


<a id="htoc8"></a>2.2.1  Installing from
rpm

To install the scripts on a RedHat system, download the RPM package
and run the following command:
<pre>
rpm -Uvh smbldap-tools-0.8.5-1.i386.rpm
</pre>

<a id="htoc9"></a>2.2.2 Installing from a
tarball

On non RedHat system, download a source archive of the scripts. The
current archive is smbldap-tools-0.8.5.tar.gz. Uncompress
it and copy all of the Perl scripts in /usr/local/sbin
directory, and the two configuration files in
/etc/opt/IDEALX/smbldap-tools/ directory:
<pre>
mkdir /etc/opt/IDEALX/smbldap-tools/
cp *.conf /etc/opt/IDEALX/smbldap-tools/
cp smbldap-* /usr/local/sbin/
</pre>
The configuration is now based on two differents files:
<ul>
<li>smbldap.conf: define global parameter</li>
<li>smbldap_bind.conf: define an administrative account to
bind to the directory</li>
</ul>
The second file <strong>must</strong> be readable only for 'root', as it
contains credentials allowing modifications on all the directory.
Make sure the files are protected by running the following
commands:
<pre>
chmod 644 /etc/opt/IDEALX/smbldap-tools/smbldap.conf
chmod 600 /etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf
</pre>

<h2><a id="htoc10"></a>3 Configuring the
smbldap-tools</h2>

As mentioned in the previous section, you'll have to update two
configuration files. The first (smbldap.conf) allows you
to set global parameter that are readable by everybody, and the
second (smbldap_bind.conf) defines two administrative
accounts to bind to a slave and a master ldap server: this file
must thus be readable only by root.

A script is named configure.pl can help you to set their
contents up. It is located in the tarball downloaded or in the
documentation directory if you got the RPM archive (see
/usr/share/doc/smbldap-tools/). Just invoke it:
<pre>
/usr/share/doc/smbldap-tools/configure.pl
</pre>
It will ask for the default values defined in your
smb.conf file, and will update the two configuration files
used by the scripts. Note that you can stop the script at any
moment with the Crtl-c keys.
Before using this script :
<ul>
<li>the two configuration files <strong>must</strong> be present in the
/etc/opt/IDEALX/smbldap-tools/ directory</li>
<li>check that samba is configured and running, as the script will
try to get your workgroup's domain secure id (SID).</li>
</ul>
In those files are parameters are defined like this:
<pre>
key="value"
</pre>
Full example configuration files can be found at <a href="#configuration::files">8.1</a>.


<h3><a id="htoc11"></a>3.1 The smbldap.conf
file</h3>

This file is used to define parameters that can be readable by
everybody. A full example file is available in section <a href="#configuration::file::smbldap">8.1.1</a>.

Let's have a look at all available parameters.
<ul>
<li>UID_START and GID_START : those parameters
are deprecated. Available uid and gid are now defined in the
default new entry cn=NextFreeUnixId,dc=idealx,dc=org.</li>
<li>SID : Secure Identifier Domain
<ul>
<li>Example:
SID="S-1-5-21-3703471949-3718591838-2324585696"</li>
<li>Remark: you can get the SID for your domain using the net
getlocalsid command. Samba must be up and running for this to
work (it can take <strong>several</strong> minutes for a Samba server to
correctly negotiate its status with other network servers).</li>
</ul>
</li>
<li>slaveLDAP : slave LDAP server
<ul>
<li>Example: slaveLDAP="127.0.0.1"</li>
<li>Remark: must be a resolvable DNS name or it's IP address</li>
</ul>
</li>
<li>slavePort : port to contact the slave server
<ul>
<li>Example: slavePort="389"</li>
</ul>
</li>
<li>masterLDAP : master LDAP server
<ul>
<li>Example: masterLDAP="127.0.0.1"</li>
</ul>
</li>
<li>masterPort : port to contact the master server
<ul>
<li>Example: masterPort="389"</li>
</ul>
</li>
<li>ldapTLS : should we use TLS connection to contact the
ldap servers ?
<ul>
<li>Example: ldapTLS="1"</li>
<li>Remark: the LDAP severs must be configured to accept TLS
connections. See section the Samba-LDAP Howto for more details
(<a href="http://samba.idealx.org/smbldap-howto.fr.html">http://samba.idealx.org/smbldap-howto.fr.html</a>).
If you are using TLS support, select port 389 to connect to the
master and slave directories.</li>
</ul>
</li>
<li>verify : How to verify the server's certificate (none,
optional or require). See "man Net::LDAP" in start_tls section for
more details
<ul>
<li>Example: verify="require"</li>
</ul>
</li>
<li>cafile : the PEM-format file containing certificates
for the CA that slapd will trust
<ul>
<li>Example:
cafile="/etc/opt/IDEALX/smbldap-tools/ca.pem"</li>
</ul>
</li>
<li>clientcert : the file that contains the client
certificate
<ul>
<li>Example:
clientcert="/etc/opt/IDEALX/smbldap-tools/smbldap-tools.iallanis.com.pem"</li>
</ul>
</li>
<li>clientkey : the file that contains the private key
that matches the certificate stored in the clientcert file
<ul>
<li>Example:
clientkey="/etc/opt/IDEALX/smbldap-tools/smbldap-tools.iallanis.com.key"</li>
</ul>
</li>
<li>suffix : The distinguished name of the search base
<ul>
<li>Example: suffix="dc=idealx,dc=com"</li>
</ul>
</li>
<li>usersdn : branch in which users account can be found
or must be added
<ul>
<li>Example: usersdn="ou=Users,${suffix}"</li>
<li>Remark: this branch is <strong>not</strong> relative to the suffix
value</li>
</ul>
</li>
<li>computersdn : branch in which computers account can be
found or must be added
<ul>
<li>Example: computersdn"ou=Computers,${suffix}"</li>
<li>Remark: this branch is <strong>not</strong> relative to the suffix
value</li>
</ul>
</li>
<li>groupsdn : branch in which groups account can be found
or must be added
<ul>
<li>Example: groupsdn="ou=Groups,${suffix}"</li>
<li>Remarks: this branch is <strong>not</strong> relative to the suffix
value</li>
</ul>
</li>
<li>idmapdn : where are stored Idmap entries (used if
samba is a domain member server)
<ul>
<li>Example: idmapdn="ou=Idmap,${suffix}"</li>
<li>Remarks: this branch is <strong>not</strong> relative to the suffix
value</li>
</ul>
</li>
<li>sambaUnixIdPooldn : object in which next uidNumber and
gidNumber available are stored
<ul>
<li>Example:
sambaUnixIdPooldn="cn=NextFreeUnixId,${suffix}"</li>
<li>Remarks: this branch is <strong>not</strong> relative to the suffix
value</li>
</ul>
</li>
<li>scope : the search scope.
<ul>
<li>Example: scope="sub"</li>
</ul>
</li>
<li>hash_encrypt : hash to be used when generating a user
password.
<ul>
<li>Example: hash_encrypt="SSHA"</li>
<li>Remark: This is used for the unix password stored in
<em>userPassword</em> attribute.</li>
</ul>
</li>
<li>crypt_salt_format="%s" : if hash_encrypt is set to
CRYPT, you may set a salt format. Default is "%s", but many systems
will generate MD5 hashed passwords if you use "$1$%.8s". This
parameter is optional.</li>
<li>userLoginShell : default shell given to users.
<ul>
<li>Example: userLoginShell="/bin/bash"</li>
<li>Remark: This is stored in <em>loginShell</em> attribute.</li>
</ul>
</li>
<li>userHome : default directory where users's home
directory are located.
<ul>
<li>Example: userHome="/home/%U"</li>
<li>Remark: This is stored in homeDirectory
attribute.</li>
</ul>
</li>
<li>userGecos : gecos used for users
<ul>
<li>Example: userGecos="System User"</li>
</ul>
</li>
<li>defaultUserGid : default primary group set to users
accounts
<ul>
<li>Example: defaultUserGid="513"</li>
<li>Remark: this is stored in <em>gidNumber</em> attribute.</li>
</ul>
</li>
<li>defaultComputerGid : default primary group set to
computers accounts
<ul>
<li>Example: defaultComputerGid="550"</li>
<li>Remark: this is stored in <em>gidNumber</em> attribute.</li>
</ul>
</li>
<li>skeletonDir : skeleton directory used for users
accounts
<ul>
<li>Example: skeletonDir="/etc/skel"</li>
<li>Remark: this option is used only if you ask for home directory
creation when adding a new user.</li>
</ul>
</li>
<li>defaultMaxPasswordAge : default validation time for a
password (in days)
<ul>
<li>Example: defaultMaxPassword="55"</li>
</ul>
</li>
<li>userSmbHome : samba share used to store user's home
directory
<ul>
<li>Example: userSmbHome="\\PDC-SMB3\
<em>home</em>\%<em>U</em>"</li>
<li>Remark: this is stored in <em>sambaHomePath</em> attribute.</li>
</ul>
</li>
<li>userProfile : samba share used to store user's profile
<ul>
<li>Example: userProfile="\\PDC-SMB3\
<em>profiles</em>\%<em>U</em>"</li>
<li>Remark: this is stored in <em>sambaProfilePath</em>
attribute.</li>
</ul>
</li>
<li>userScript : default user netlogon script name. If not
used, will be automatically <em>username.cmd</em>
<ul>
<li>Example: userScript="%U"</li>
<li>Remark: this is stored in <em>sambaProfilePath</em>
attribute.</li>
</ul>
</li>
<li>userHomeDrive : letter used on windows system to map
the home directory
<ul>
<li>Example: userHomeDrive="K:"</li>
</ul>
</li>
<li>with_smbpasswd : should we use the <em>smbpasswd</em>
command to set the user's password (instead of the <em>mkntpwd</em>
utility) ?
<ul>
<li>Example: with_smbpasswd="0"</li>
<li>Remark: must be a boolean value (0 or 1).</li>
</ul>
</li>
<li>smbpasswd : path to the smbpasswd binary
<ul>
<li>Example: smbpasswd="/usr/bin/smbpasswd"</li>
</ul>
</li>
<li>mk_ntpasswd : path to the mkntpwd binary
<ul>
<li>Example: mk_ntpasswd="/usr/local/sbin/mkntpwd"</li>
<li>Remark: the rpm package of the smbldap-tools will install this
utility. If you are using the tarball archive, you have to install
it yourself (sources are also in the smbldap-tools archive).</li>
</ul>
</li>
<li>mailDomain : Domain appended to the users "mail"
attribute.
<ul>
<li>Example: mailDomain="idealx.org"</li>
</ul>
</li>
</ul>

<h3><a id="htoc12"></a>3.2 The smbldap_bind.conf
file</h3>

This file is only used by <em>root</em> to modify the content of the
directory. It contains distinguised names and credentials to
connect to both the master and slave directories. A full example
file is available in section <a href="#configuration::file::smbldap::bind">8.1.2</a>.

Let's have a look at all available parameters.
<ul>
<li>slaveDN : distinguished name used to bind to the slave
server
<ul>
<li>Example 1: slaveDN="cn=Manager,dc=idealx,dc=com"</li>
<li>Example 2: slaveDN=""</li>
<li>Remark: this can be the manager account of the directory or any
LDAP account that has sufficient permissions to read the full
directory (Slave directory is only used for reading). Anonymous
connections uses the second example form.</li>
</ul>
</li>
<li>slavePw : the credentials to bind to the slave server
<ul>
<li>Example 1: slavePw="secret"</li>
<li>Example 2: slavePw=""</li>
<li>Remark: the password must be stored here in clear form. This
file must then be readable only by root! All anonymous connections
use the second form provided in our example.</li>
</ul>
</li>
<li>masterDN : the distinguished name used to bind to the
master server
<ul>
<li>Example: masterDN="cn=Manager,dc=idealx,dc=com"</li>
<li>Remark: this can be the manager account of the directory or any
LDAP account that has enough permissions to modify the content of
the directory. Anonymous access does not make any sense here.</li>
</ul>
</li>
<li>masterPw : the credentials to bind to the master
server
<ul>
<li>Example: masterPw="secret"</li>
<li>Remark: the password must be in clear text. Be sure to protect
this file against unauthorized readers!</li>
</ul>
</li>
</ul>

<h2><a id="htoc13"></a>4 Using the scripts</h2>


<h3><a id="htoc14"></a>4.1 Initial directory's
population</h3>

You can initialize the LDAP directory using the
smbldap-populate script. To do that, the account defined
in the /etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf to
access the master directory <strong>must</strong> must be the manager account
defined in the directory configuration. On RedHat system, this file
is /etc/openldap/slapd.conf and the account is defined
with
<pre>
rootdn "cn=Manager,dc=idealx,dc=com"
rootpw secret
</pre>
The smbldap_bind.conf file must then be configured so that
the parameters to connect to the master LDAP server match the
previous ones:
<pre>
masterDN="cn=Manager,dc=idealx,dc=com"
masterPw="secret"
</pre>
Available options for this script are summarized in the table
<a href="#table::populate">1</a>:


<br/>
<a id="code_epsilon_var"></a>

<table class="gilo" rules="rows" frame="hsides" width="100%"><tbody>
<tr>
<td>option</td>
<td>definition</td>
<td>default value</td>
</tr>
<tr>
<td>-u <em>uidNumber</em></td>
<td>first uidNumber to allocate</td>
<td>1000</td>
</tr>
<tr>
<td>-g <em>gidNumber</em></td>
<td>first uidNumber to allocate</td>
<td>1000</td>
</tr>
<tr>
<td>-a <em>user</em></td>
<td>administrator login name</td>
<td>Administrator</td>
</tr>
<tr>
<td>-b <em>user</em></td>
<td>guest login name</td>
<td>nobody</td>
</tr>
<tr>
<td>-e <em>file</em></td>
<td>export a init file</td>
<td> </td>
</tr>
<tr>
<td>-i <em>file</em></td>
<td>import a init file</td>
<td> </td>
</tr>
</tbody></table>


Table 1: Options available for the
smbldap-populate script

<a id="table::populate"></a>

<br/>

In the more general case, to set up your directory, simply use the
following command:
<pre>
[root@etoile root]# smbldap-populate
Using builtin directory structure
adding new entry: dc=idealx,dc=com
adding new entry: ou=Users,dc=idealx,dc=com
adding new entry: ou=Groups,dc=idealx,dc=com
adding new entry: ou=Computers,dc=idealx,dc=com
adding new entry: ou=Idmap,dc=idealx,dc=org
adding new entry: cn=NextFreeUnixId,dc=idealx,dc=org
adding new entry: uid=Administrator,ou=Users,dc=idealx,dc=com
adding new entry: uid=nobody,ou=Users,dc=idealx,dc=com
adding new entry: cn=Domain Admins,ou=Groups,dc=idealx,dc=com
adding new entry: cn=Domain Users,ou=Groups,dc=idealx,dc=com
adding new entry: cn=Domain Guests,ou=Groups,dc=idealx,dc=com
adding new entry: cn=Print Operators,ou=Groups,dc=idealx,dc=com
adding new entry: cn=Backup Operators,ou=Groups,dc=idealx,dc=com
adding new entry: cn=Replicator,ou=Groups,dc=idealx,dc=com
adding new entry: cn=Domain Computers,ou=Groups,dc=idealx,dc=com
</pre>
After this step, if you don't want to use the
cn=Manager,dc=idealx,dc=com account anymore, you can
create a dedicated account for Samba and the smbldap-tools. See
section <a href="#change::manager">8.2</a> for more details.

The cn=NextFreeUnixId,dc=idealx,dc=org entry is only used
to defined the next uidNumber and gidNumber available for creating
new users and groups. The default values for those numbers are
1000. You can change it with the -u and -g
option. For example, if you want the first available value for
uidNumber and gidNumber to be set to 1500, you can use the
following command :
<pre>
smbldap-populate -u 1550 -g 1500
</pre>

<h3><a id="htoc15"></a>4.2 User management</h3>


<a id="htoc16"></a>4.2.1 Adding a user

<a id="add::user"></a> To add a user, use the
smbldap-useradd script. Available options are summarized
in the table <a href="#table::add::user">2</a>. If applicable,
default values are mentionned in the third column. Any string
beginning with a $ symbol refers to a parameter defined in the
/etc/opt/IDEALX/smbldap-tools/smbldap.conf configuration
file.


<br/>

<table class="gilo" rules="rows" frame="hsides" width="100%"><tbody>
<tr>
<td>option</td>
<td>definition</td>
<td>example</td>
<td>default value</td>
</tr>
<tr>
<td>-a</td>
<td>create a Windows account. Otherwise,
only a Posix account is created</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-w</td>
<td>create a Windows Workstation
account</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-i</td>
<td>create an interdomain trust account.
See section <a href="#trust::account">4.4</a> for more details</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-u</td>
<td>set a uid value</td>
<td>-u 1003</td>
<td>first uid available</td>
</tr>
<tr>
<td>-g</td>
<td>set a gid value</td>
<td>-g 1003</td>
<td>first gid available</td>
</tr>
<tr>
<td>-G</td>
<td>add the new account to one or several
supplementary groups (comma-separated)</td>
<td>-G 512,550</td>
<td> </td>
</tr>
<tr>
<td>-d</td>
<td>set the home directory</td>
<td>-d /var/user</td>
<td>$userHomePrefix/user</td>
</tr>
<tr>
<td>-s</td>
<td>set the login shell</td>
<td>-s /bin/ksh</td>
<td>$userLoginShell</td>
</tr>
<tr>
<td>-c</td>
<td>set the user gecos</td>
<td>-c "admin user"</td>
<td>$userGecos</td>
</tr>
<tr>
<td>-m</td>
<td>creates user's home directory and
copies /etc/skel into it</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-k</td>
<td>set the skeleton dir (with -m)</td>
<td>-k /etc/skel2</td>
<td>$skeletonDir</td>
</tr>
<tr>
<td>-P</td>
<td>ends by invoking smbldap-passwd to
set the user's password</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-A</td>
<td>user can change password ? 0 if no, 1
if yes</td>
<td>-A 1</td>
<td> </td>
</tr>
<tr>
<td>-B</td>
<td>user must change password at first
session ? 0 if no, 1 if yes</td>
<td>-B 1</td>
<td> </td>
</tr>
<tr>
<td>-C</td>
<td>set the samba home share</td>
<td>-C \\PDC\homes</td>
<td>$userSmbHome</td>
</tr>
<tr>
<td>-D</td>
<td>set a letter associated with the home
share</td>
<td>-D H:</td>
<td>$userHomeDrive</td>
</tr>
<tr>
<td>-E</td>
<td>set DOS script to execute on
login</td>
<td>-E common.bat</td>
<td>$userScript</td>
</tr>
<tr>
<td>-F</td>
<td>set the profile directory</td>
<td>-F \\PDC\profiles\user</td>
<td>$userProfile</td>
</tr>
<tr>
<td>-H</td>
<td>set the samba account control bits
like'[NDHTUMWSLKI]'</td>
<td>-H [X]</td>
<td> </td>
</tr>
<tr>
<td>-N</td>
<td>set the canonical name of the
user</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-S</td>
<td>set the surname of the user</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>-M</td>
<td>local mailAddress (comma
seperated)</td>
<td>-M testuser,aliasuser</td>
<td> </td>
</tr>
<tr>
<td>-T</td>
<td>forward mail address (comma
seperated)</td>
<td>-T testuser@domain.org</td>
<td> </td>
</tr>
</tbody></table>


Table 2: Options available to the
smbldap-useradd script

<a id="table::add::user"></a>

<br/>

For example, if you want to add a user named <em>user_admin</em> and
who :
<ul>
<li>is a windows user</li>
<li>must belong to the group of gid=512 ('Domain Admins'
group)</li>
<li>has a home directory</li>
<li>does not have a login shell</li>
<li>has a homeDirectory set to /dev/null</li>
<li>does not have a roaming profile</li>
<li>and for whom we want to set a first login password</li>
</ul>
you must invoke:
<pre>
smbldap-useradd -a -G 512 -m -s /bin/false -d /dev/null -F "" -P user_admin
</pre>

<a id="htoc17"></a>4.2.2 Removing a user

To remove a user account, use the smbldap-userdel script.
Available options are


<br/>

<table class="gilo" rules="rows" frame="hsides" width="100%"><tbody>
<tr>
<td>option</td>
<td>definition</td>
</tr>
<tr>
<td>-r</td>
<td>remove home directory</td>
</tr>
<tr>
<td>-R</td>
<td>remove home directory
interactively</td>
</tr>
</tbody></table>


Table 3: Option available to the
smbldap-userdel script

<a id="table::del::user"></a>

<br/>

For example, if you want to remove the <em>user1</em> account from
the LDAP directory, and if you also want to delete his home
directory, use the following command :
<pre>
smbldap-userdel -r user1
</pre>
Note: '-r' is dangerous as it may delete precious and unbackuped
data, please be careful.


<a id="htoc18"></a>4.2.3 Modifying a user

<a id="modify::user"></a> To modify a user
account, use the smbldap-usermod script. Availables
options are listed in the table <a href="#table::modify::user">4</a>.


<br/>

<table class="gilo" rules="rows" frame="hsides" width="100%"><tbody>
<tr>
<td>option</td>
<td>definition</td>
<td>example</td>
</tr>
<tr>
<td>-c</td>
<td>set the user gecos</td>
<td>-c "admin user"</td>
</tr>
<tr>
<td>-d</td>
<td>set the home directory</td>
<td>-d /var/user</td>
</tr>
<tr>
<td>-u</td>
<td>set a uid value</td>
<td>-u 1003</td>
</tr>
<tr>
<td>-g</td>
<td>set a gid value</td>
<td>-g 1003</td>
</tr>
<tr>
<td>-G</td>
<td>add the new account to one or several
supplementary groups (comma-separated)</td>
<td>-G 512,550</td>
</tr>
<tr>
<td/>
<td/>
<td>-G -512,550</td>
</tr>
<tr>
<td/>
<td/>
<td>-G +512,550</td>
</tr>
<tr>
<td>-s</td>
<td>set the login shell</td>
<td>-s /bin/ksh</td>
</tr>
<tr>
<td>-N</td>
<td>set the canonical name of the
user</td>
<td> </td>
</tr>
<tr>
<td>-S</td>
<td>set the surname of the user</td>
<td> </td>
</tr>
<tr>
<td>-P</td>
<td>ends by invoking smbldap-passwd to
set the user's password</td>
<td> </td>
</tr>
<tr>
<td>-a</td>
<td>add sambaSAMAccount objectclass</td>
<td> </td>
</tr>
<tr>
<td>-e</td>
<td>set an expiration date for the
password (format: YYYY-MM-DD HH:MM:SS)</td>
<td> </td>
</tr>
<tr>
<td>-A</td>
<td>user can change password ? 0 if no, 1
if yes</td>
<td>-A 1</td>
</tr>
<tr>
<td>-B</td>
<td>user must change password at first
session ? 0 if no, 1 if yes</td>
<td>-B 1</td>
</tr>
<tr>
<td>-C</td>
<td>set the samba home share</td>
<td>-C \\PDC\homes</td>
</tr>
<tr>
<td/>
<td/>
<td>-C ""</td>
</tr>
<tr>
<td>-D</td>
<td>set a letter associated with the home
share</td>
<td>-D H:</td>
</tr>
<tr>
<td/>
<td/>
<td>-D ""</td>
</tr>
<tr>
<td>-E</td>
<td>set DOS script to execute on
login</td>
<td>-E common.bat</td>
</tr>
<tr>
<td/>
<td/>
<td>-E ""</td>
</tr>
<tr>
<td>-F</td>
<td>set the profile directory</td>
<td>-F \\PDC\profiles\user</td>
</tr>
<tr>
<td/>
<td/>
<td>-F ""</td>
</tr>
<tr>
<td>-H</td>
<td>set the samba account control bits
like'[NDHTUMWSLKI]'</td>
<td>-H [X]</td>
</tr>
<tr>
<td>-I</td>
<td>disable a user account</td>
<td>-I 1</td>
</tr>
<tr>
<td>-J</td>
<td>enable a user</td>
<td>-J 1</td>
</tr>
<tr>
<td>-M</td>
<td>local mailAddress (comma
seperated)</td>
<td>-M testuser,aliasuser</td>
</tr>
<tr>
<td>-T</td>
<td>forward mail address (comma
seperated)</td>
<td>-T testuser@domain.org</td>
</tr>
</tbody></table>


Table 4: Options available to the
smbldap-usermod script

<a id="table::modify::user"></a>

<br/>

You can also use the smbldap-userinfo script to update
user's information. This script can also be used by users
themselves to update their own informations listed in the tables
<a href="#table::modify::self::user">5</a> (adequats ACL must be
set in the directory server). Available options are :


<br/>

<table class="gilo" rules="rows" frame="hsides" width="100%"><tbody>
<tr>
<td>option</td>
<td>definition</td>
<td>example</td>
</tr>
<tr>
<td>-f</td>
<td>set the full name's user</td>
<td>-f MyName</td>
</tr>
<tr>
<td>-r</td>
<td>set the room number</td>
<td>-r 99</td>
</tr>
<tr>
<td>-w</td>
<td>set the work phone number</td>
<td>-w 111111111</td>
</tr>
<tr>
<td>-h</td>
<td>set the home phone number</td>
<td>-h 222222222</td>
</tr>
<tr>
<td>-o</td>
<td>set other information (in gecos
definition)</td>
<td>-o "second stage"</td>
</tr>
<tr>
<td>-s</td>
<td>set the default bash</td>
<td>-s /bin/ksh</td>
</tr>
</tbody></table>


Table 5: Options available to the
smbldap-userinfo script

<a id="table::modify::self::user"></a>

<br/>


<h3><a id="htoc19"></a>4.3 Group management</h3>


<a id="htoc20"></a>4.3.1 Adding a group

To add a new group in the LDAP directory, use the
smbldap-groupadd script. Available options are listed in
the table <a href="#table::add::group">6</a>.


<br/>

<table class="gilo" rules="rows" frame="hsides" width="100%"><tbody>
<tr>
<td>option</td>
<td>definition</td>
<td>example</td>
</tr>
<tr>
<td>-a</td>
<td>add automatic group mapping
entry</td>
<td> </td>
</tr>
<tr>
<td>-g gid</td>
<td>set the <em>gidNumer</em> for this
group to <em>gid</em></td>
<td>-g 1002</td>
</tr>
<tr>
<td>-o</td>
<td>gidNumber is not unique</td>
<td> </td>
</tr>
<tr>
<td>-r
group-rid</td>
<td>set the rid of the group to
<em>group-rid</em></td>
<td>-r 1002</td>
</tr>
<tr>
<td>-s
group-sid</td>
<td>set the sid of the group to
<em>group-sid</em></td>
<td>-s
S-1-5-21-3703471949-3718591838-2324585696-1002</td>
</tr>
<tr>
<td>-t
group-type</td>
<td>set the <em>sambaGroupType</em> to
<em>group-type</em></td>
<td>-t 2</td>
</tr>
<tr>
<td>-p</td>
<td>print the gidNumber to stdout</td>
<td> </td>
</tr>
</tbody></table>


Table 6: Options available for the
smbldap-groupadd script

<a id="table::add::group"></a>

<br/>


<a id="htoc21"></a>4.3.2 Removing a group

To remove the group named group1, just use the following
command :
<pre>
smbldap-userdel group1
</pre>

<h3><a id="htoc22"></a>4.4 Adding a interdomain
trust account</h3>

<a id="trust::account"></a> To add an
interdomain trust account to the primary controller
<em>trust-pdc</em>, use the -i option of
smbldap-useradd as follows :
<pre>
[root@etoile root]# smbldap-useradd -i trust-pdc
New password : *******
Retype new password : *******
</pre>
The script will terminate asking for a password for this trust
account. The account will be created in the directory branch where
all computer accounts are stored (ou=Computers by
default). The only two particularities of this account are that you
are setting a password for this account, and the flags of this
account are [I ].

<h2><a id="htoc23"></a>5 Samba and the smbldap-tools
scripts</h2>


<h3><a id="htoc24"></a>5.1 General
configuration</h3>

Samba can be configured to use the smbldap-tools scripts. This allows administrators to
add, delete or modify user and group accounts for Microsoft Windows operating systems using, for example,
User Manager utility under MS-Windows. To enable the use of this
utility, samba needs to be configured correctly. The
smb.conf configuration file must contain the following
directives :
<pre>
ldap delete dn = Yes
add user script = /usr/local/sbin/smbldap-useradd -m "%u"
add machine script = /usr/local/sbin/smbldap-useradd -w "%u"
add group script = /usr/local/sbin/smbldap-groupadd -p "%g"
add user to group script = /usr/local/sbin/smbldap-groupmod -m "%u" "%g"
delete user from group script = /usr/local/sbin/smbldap-groupmod -x "%u" "%g"
set primary group script = /usr/local/sbin/smbldap-usermod -g "%g" "%u"
</pre>
Remark: the two directives delete user script et
delete group script can also be used. However, an error
message can appear in User Manager even if the operations actually
succeed. If you want to enable this behaviour, you need to add
<pre>
delete user script = /usr/local/sbin/smbldap-userdel "%u"
delete group script = /usr/local/sbin/smbldap-groupdel "%g"
</pre>

<h3><a id="htoc25"></a>5.2 Migrating an NT4 PDC to
Samba3</h3>

The account migration procedure becomes really simple when samba is
configured to use the smbldap-tools. Samba
configuration (smb.conf file) must contain the directive defined
above to properly call the script for managing users, groups and
computer accounts. The migration process is outlined in the chapter
30 of the samba howto <a href="http://sambafr.idealx.org/samba/docs/man/Samba-HOWTO-Collection/NT4Migration.html">
http://sambafr.idealx.org/samba/docs/man/Samba-HOWTO-Collection/NT4Migration.html</a>.



<h2><a id="htoc26"></a>6 Frequently Asked
Questions</h2>


<h3><a id="htoc27"></a>6.1 How can i use old
released uidNumber and gidNumber ?</h3>

There are two way to do this :
<ul>
<li>modify the cn=NextFreeUnixId,dc=idealx,dc=org and
change the uidNumber and/or gidNumber value. This
must be done manually. For example, if you want to use all
available uidNumber and gidNumber higher then 1500, you need to
create a update-NextFreeUnixId.ldif file containing :
<pre>
dn: cn=NextFreeUnixId,dc=idealx,dc=org
changetype: modify
uidNumber: 1500
gidNumber: 1500
</pre>
and then update the directory :
<pre>
ldapmodify -x -D "cn=Manager,dc=idealx,dc=org" -w secret -f update-NextFreeUnixId.ldif
</pre></li>
<li>use the -u or -g option to the script you
need to set the value you want to use</li>
</ul>

<h3><a id="htoc28"></a>6.2 I always have this error:
"Can't locate IO/Socket/SSL.pm"</h3>

This happens when you want to use a certificate. In this case, you
need to install the IO-Socket-SSL Perl module.


<h3><a id="htoc29"></a>6.3 I can't initialize the
directory with smbldap-populate</h3>

When I want to initialize the directory using the
smbldap-populate script, I get
<pre>
[root@slave sbin]# smbldap-populate.pl
Using builtin directory structure
adding new entry: dc=IDEALX,dc=COM
Can't call method "code" without a package or object reference at
/usr/local/sbin/smbldap-populate.pl line 270, &lt;GEN1&gt; line 2.
</pre>
Answer: check the TLS configuration
<ul>
<li>if you don't want to use TLS support, set the
/etc/opt/IDEALX/smbldap-tools/smbldap.conf file with
<pre>
ldapSSL="0"
</pre></li>
<li>if you want TLS support, set the
/etc/opt/IDEALX/smbldap-tools/smbldap.conf file with
<pre>
ldapSSL="1"
</pre>
and check that the directory server is configured to accept TLS
connections.</li>
</ul>

<h3><a id="htoc30"></a>6.4 I can't join the domain
with the root account</h3>

<ul>
<li>check that the root account has the sambaSamAccount
objectclass</li>
<li>check that the directive add machine script is present
and configured</li>
</ul>

<h3><a id="htoc31"></a>6.5 I have the
sambaSamAccount but i can't logged in</h3>

Check that the sambaPwdLastSet attribute is not null
(equal to 0)


<h3><a id="htoc32"></a>6.6 I want to create machine
account on the fly, but it does not works or I must do it
twice</h3>

<ul>
<li>The script defined with the add machine script must
not add the sambaSAMAccount objectclass of the machine
account. The script must only add the Posix machine account. Samba
will add the sambaSAMAccount when joining the domain.</li>
<li>Check that the add <strong>machine</strong> script is present in
samba configuration file.</li>
</ul>

<h3><a id="htoc33"></a>6.7 I can't manage the Oracle
Internet Database</h3>

If you have an error message like :
<pre>
Function Not Implemented at /usr/local/sbin/smbldap_tools.pm line 187.
Function Not Implemented at /usr/local/sbin/smbldap_tools.pm line 627.
</pre>
For Oracle Database, all attributes that will be resquested to the
directory must be indexed. Add a new index for samba attributes and
make sure that the following attributes are also indexed :
uidNumber, gidNumber, memberUid, homedirectory, description,
userPassword ...


<h3><a id="htoc34"></a>6.8 The directive passwd
program = /usr/local/sbin/smbldap-passwd -u %u is not called,
or i got a error message when changing the password from
windows</h3>

The directive is called if you also set unix password sync =
Yes. Notes:
<ul>
<li>if you use OpenLDAP, none of those two options are needed. You
just need ldap passwd sync = Yes.</li>
<li>the script called here must only update the
userPassword attribute. This is the reason of the
-u option. Samba passwords will be updated by samba
itself.</li>
<li>the passwd chat directive must match what is prompted
when using the smbldap-passwd command</li>
</ul>

<h3><a id="htoc35"></a>6.9 New computers account
can't be set in ou=computers</h3>

<a id="sec::bug::ou::computer"></a>
This is a known samba bug. There's a workarround: look at <a href="http://marc.theaimsgroup.com/?l=samba&amp;m=108439612826440&amp;w=2">
http://marc.theaimsgroup.com/?l=samba&amp;m=108439612826440&amp;w=2</a>



<h3><a id="htoc36"></a>6.10 I can join the domain,
but i can't log on</h3>

look at section <a href="#sec::bug::ou::computer">6.9</a>


<h3><a id="htoc37"></a>6.11 I can't create a user
with smbldap-useradd</h3>

When creating a new user account I get the following error message:
<pre>
/usr/local/sbin/smbldap-useradd.pl: unknown group SID not set for unix group 513
</pre>
Answer:
<ul>
<li>is nss_ldap correctly configured ?</li>
<li>is the default group's users mapped to the 'Domain Users' NT
group ?
<pre>
net groupmap add rid=513 unixgroup="Domain Users" ntgroup="Domain Users"
</pre></li>
</ul>

<h3><a id="htoc38"></a>6.12 smbldap-useradd: Can't
call method "get_value" on an undefined value at
/usr/local/sbin/smbldap-useradd line 154</h3>

<ul>
<li>does the default group defined in smbldap.conf exist
(defaultUserGid="513") ?</li>
<li>does the NT "Domain Users" group mapped to a unix group of rid
513 (see option <em>-r</em> of smbldap-groupadd and
smbldap-groupmod to set a rid) ?</li>
</ul>

<h3><a id="htoc39"></a>6.13 Typical errors on
creating a new user or a new group</h3>

<a id="faq::error::add::user"></a>
<ul>
<li>i've got the following error:
<pre>
Could not find base dn, to get next uidNumber at /usr/local/sbin//smbldap_tools.pm line 909
</pre>
<ul>
<li>you do not have created the object to defined the next
uidNumber and gidNumber available.
<ul>
<li>for version 0.8.7 : you can just run the
smbldap-populate script that will update the sambaDomain
entry to store those informations</li>
<li>for version before 0.8.7 : You have updated the smbldap-tools
to version 0.8.5 or newer. You have to do this manually. Create an
file called add.ldif and containing
<pre>
dn: cn=NextFreeUnixId,dc=idealx,dc=org
objectClass: inetOrgPerson
objectClass: sambaUnixIdPool
uidNumber: 1000
gidNumber: 1000
cn: NextFreeUnixId
sn: NextFreeUnixId
</pre>
and then add the object with the ldapadd utility:
<pre>
$ ldapadd -x -D "cn=Manager,dc=idealx,dc=org" -w secret -f add.ldif
</pre>
Here, 1000 is the first available value for uidNumber and gidNumber
(of course, if this value is already used by a user or a group, the
first available after 1000 will be used).</li>
</ul>

</li>
<li>The error also appear when there is a need for TLS (ldapTLS=1
in smbldap.conf) and something is wrong with certificate
naming or path settings.</li>
</ul>

</li>
<li>i've got the following error:
<pre>
Use of uninitialized value in string at
/usr/local/sbin//smbldap\_tools.pm line 914.
Error: No DN specified at /usr/local/sbin//smbldap\_tools.pm line 919
</pre>
You have not updated the configuration file to defined the object
where are sotred the next uidNumber and gidNumber available. In our
example, you have to add a nex entry in
<em>/etc/opt/IDEALX/smbldap-tools/smbldap.conf</em> containing :
<pre>
# Where to store next uidNumber and gidNumber available
sambaUnixIdPooldn="cn=NextFreeUnixId,${suffix}"
</pre>
btw, a new option is now available too: the domain to append to
users. You can add to the configuration file the following lines:
<pre>
# Domain appended to the users "mail"-attribute
# when smbldap-useradd -M is used mailDomain="idealx.com"
</pre>

</li>
<li>i've got the following error:
<pre>
Use of uninitialized value in concatenation (.) or string at /usr/local/sbin/smbldap-useradd line 183.
Use of uninitialized value in substitution (s///) at /usr/local/sbin/smbldap-useradd line 185.
Use of uninitialized value in string at /usr/local/sbin/smbldap-useradd line 264.
failed to add entry: homedirectory: value #0 invalid per syntax at /usr/local/sbin/smbldap-useradd line 280.
userHomeDirectory=User "jto" already member of the group "513".
failed to add entry: No such object at /usr/local/sbin/smbldap-useradd line 382.
</pre>
you have to change the variable name userHomePrefix to
userHome in
<em>/etc/opt/IDEALX/smbldap-tools/smbldap.conf</em>
</li>
<li>i've got the following error:
<pre>
failed to add entry: referral missing at /usr/local/sbin/smbldap-useradd line 279, &lt;DATA&gt; line 283.
</pre>
you have to update the configuration file that defined users,
groups and computers dn. Those parameters must not be relative to
the suffix parameter. A typical configuration look like
this :
<pre>
usersdn="ou=Users,${suffix}"
computersdn="ou=Computers,${suffix}"
groupsdn="ou=Groups,${suffix}"
</pre>

</li>
<li>i've got the following error:
<pre>
erreur LDAP: Can't contact master ldap server (IO::Socket::INET: Bad protocol 'tcp')
at /usr/local/sbin//smbldap_tools.pm line 153.
</pre>
remove <em>ldap</em> from <em>/etc/nsswitch.conf</em> for
<em>services</em> list of possible check. For example, if your ldap
directory is not configured to give services information, you must
have
<pre>
services files
</pre>
and not
<pre>
services: ldap [NOTFOUND=return] files
</pre></li>
</ul>

<h2><a id="htoc40"></a>7 Thanks</h2>

<a id="thanks"></a> People who have worked on this
document are
<ul>
<li>Jérôme Tournier &lt;jerome.tournier@IDEALX.com&gt;</li>
<li>David Barth &lt;david.barth@IDEALX.com&gt;</li>
<li>Nat Makarevitch &lt;nat@IDEALX.com&gt;</li>
</ul>
The authors would like to thank the following people for providing
help with some of the more complicated subjects, for clarifying
some of the internal workings of Samba or
OpenLDAP, for pointing out errors or
mistakes in previous versions of this document, or generally for
making suggestions :
<ul>
<li>IDEALX team :
<ul>
<li>Roméo Adekambi &lt;romeo.adekambi@IDEALX.com&gt;</li>
<li>Aurelien Degremont &lt;adegremont@IDEALX.com&gt;</li>
<li>Renaud Renard &lt;rrenard@IDEALX.com&gt;</li>
</ul>
</li>
<li>John H Terpstra &lt;jht@samba.org&gt;</li>
</ul>

<h2><a id="htoc41"></a>8 Annexes</h2>


<h3><a id="htoc42"></a>8.1 Full configuration
files</h3>

<a id="configuration::files"></a>

<a id="htoc43"></a>8.1.1 The
/etc/opt/IDEALX/smbldap-tools/smbldap.conf file

<a id="configuration::file::smbldap"></a>
<pre>
# $Source: /opt/cvs/samba/smbldap-tools/smbldap.conf,v $
# $Id: smbldap.conf,v 1.17 2005/01/29 15:00:54 jtournier Exp $
#
# smbldap-tools.conf : Q &amp; D configuration file for smbldap-tools

# This code was developped by IDEALX (http://IDEALX.org/) and
# contributors (their names can be found in the CONTRIBUTORS file).
#
# Copyright (C) 2001-2002 IDEALX
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.

# Purpose :
# . be the configuration file for all smbldap-tools scripts

##############################################################################
#
# General Configuration
#
##############################################################################

# Put your own SID. To obtain this number do: "net getlocalsid".
# If not defined, parameter is taking from "net getlocalsid" return
SID="S-1-5-21-4205727931-4131263253-1851132061"

# Domain name the Samba server is in charged.
# If not defined, parameter is taking from smb.conf configuration file
# Ex: sambaDomain="IDEALX-NT"
sambaDomain="IDEALX-NT"

##############################################################################
#
# LDAP Configuration
#
##############################################################################

# Notes: to use to dual ldap servers backend for Samba, you must patch
# Samba with the dual-head patch from IDEALX. If not using this patch
# just use the same server for slaveLDAP and masterLDAP.
# Those two servers declarations can also be used when you have
# . one master LDAP server where all writing operations must be done
# . one slave LDAP server where all reading operations must be done
# (typically a replication directory)

# Slave LDAP server
# Ex: slaveLDAP=127.0.0.1
# If not defined, parameter is set to "127.0.0.1"
slaveLDAP="127.0.0.1"

# Slave LDAP port
# If not defined, parameter is set to "389"
slavePort="389"

# Master LDAP server: needed for write operations
# Ex: masterLDAP=127.0.0.1
# If not defined, parameter is set to "127.0.0.1"
masterLDAP="127.0.0.1"

# Master LDAP port
# If not defined, parameter is set to "389"
masterPort="389"

# Use TLS for LDAP
# If set to 1, this option will use start_tls for connection
# (you should also used the port 389)
# If not defined, parameter is set to "1"
ldapTLS="1"

# How to verify the server's certificate (none, optional or require)
# see "man Net::LDAP" in start_tls section for more details
verify="require"

# CA certificate
# see "man Net::LDAP" in start_tls section for more details
cafile="/etc/opt/IDEALX/smbldap-tools/ca.pem"

# certificate to use to connect to the ldap server
# see "man Net::LDAP" in start_tls section for more details
clientcert="/etc/opt/IDEALX/smbldap-tools/smbldap-tools.pem"

# key certificate to use to connect to the ldap server
# see "man Net::LDAP" in start_tls section for more details
clientkey="/etc/opt/IDEALX/smbldap-tools/smbldap-tools.key"

# LDAP Suffix
# Ex: suffix=dc=IDEALX,dc=ORG
suffix="dc=idealx,dc=org"

# Where are stored Users
# Ex: usersdn="ou=Users,dc=IDEALX,dc=ORG"
# Warning: if 'suffix' is not set here, you must set the full dn for usersdn
usersdn="ou=Users,${suffix}"

# Where are stored Computers
# Ex: computersdn="ou=Computers,dc=IDEALX,dc=ORG"
# Warning: if 'suffix' is not set here, you must set the full dn for computersdn
computersdn="ou=Computers,${suffix}"

# Where are stored Groups
# Ex: groupsdn="ou=Groups,dc=IDEALX,dc=ORG"
# Warning: if 'suffix' is not set here, you must set the full dn for groupsdn
groupsdn="ou=Groups,${suffix}"

# Where are stored Idmap entries (used if samba is a domain member server)
# Ex: groupsdn="ou=Idmap,dc=IDEALX,dc=ORG"
# Warning: if 'suffix' is not set here, you must set the full dn for idmapdn
idmapdn="ou=Idmap,${suffix}"

# Where to store next uidNumber and gidNumber available for new users and groups
# If not defined, entries are stored in sambaDomainName object.
# Ex: sambaUnixIdPooldn="sambaDomainName=${sambaDomain},${suffix}"
# Ex: sambaUnixIdPooldn="cn=NextFreeUnixId,${suffix}"
sambaUnixIdPooldn="sambaDomainName=IDEALX-NT,${suffix}"

# Default scope Used
scope="sub"

# Unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA, CLEARTEXT)
hash_encrypt="SSHA"

# if hash_encrypt is set to CRYPT, you may set a salt format.
# default is "%s", but many systems will generate MD5 hashed
# passwords if you use "$1$%.8s". This parameter is optional!
crypt_salt_format="%s"

##############################################################################
#
# Unix Accounts Configuration
#
##############################################################################

# Login defs
# Default Login Shell
# Ex: userLoginShell="/bin/bash"
userLoginShell="/bin/bash"

# Home directory
# Ex: userHome="/home/%U"
userHome="/home/%U"

# Default mode used for user homeDirectory
userHomeDirectoryMode="700"

# Gecos
userGecos="System User"

# Default User (POSIX and Samba) GID
defaultUserGid="513"

# Default Computer (Samba) GID
defaultComputerGid="515"

# Skel dir
skeletonDir="/etc/skel"

# Default password validation time (time in days) Comment the next line if
# you don't want password to be enable for defaultMaxPasswordAge days (be
# careful to the sambaPwdMustChange attribute's value)
defaultMaxPasswordAge="45"

##############################################################################
#
# SAMBA Configuration
#
##############################################################################

# The UNC path to home drives location (%U username substitution)
# Just set it to a null string if you want to use the smb.conf 'logon home'
# directive and/or disable roaming profiles
# Ex: userSmbHome="\\PDC-SMB3\%U"
userSmbHome="\\PDC-SRV\%U"

# The UNC path to profiles locations (%U username substitution)
# Just set it to a null string if you want to use the smb.conf 'logon path'
# directive and/or disable roaming profiles
# Ex: userProfile="\\PDC-SMB3\profiles\%U"
userProfile="\\PDC-SRV\profiles\%U"

# The default Home Drive Letter mapping
# (will be automatically mapped at logon time if home directory exist)
# Ex: userHomeDrive="H:"
userHomeDrive="H:"

# The default user netlogon script name (%U username substitution)
# if not used, will be automatically username.cmd
# make sure script file is edited under dos
# Ex: userScript="startup.cmd" # make sure script file is edited under dos
userScript="logon.bat"

# Domain appended to the users "mail"-attribute
# when smbldap-useradd -M is used
# Ex: mailDomain="idealx.com"
mailDomain="idealx.com"

##############################################################################
#
# SMBLDAP-TOOLS Configuration (default are ok for a RedHat)
#
##############################################################################

# Allows not to use smbpasswd (if with_smbpasswd == 0 in smbldap_conf.pm) but
# prefer Crypt::SmbHash library
with_smbpasswd="0"
smbpasswd="/usr/bin/smbpasswd"

# Allows not to use slappasswd (if with_slappasswd == 0 in smbldap_conf.pm)
# but prefer Crypt:: libraries
with_slappasswd="0"
slappasswd="/usr/sbin/slappasswd"

# comment out the following line to get rid of the default banner
# no_banner="1"

</pre>

<a id="htoc44"></a>8.1.2 The
/etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf file

<a id="configuration::file::smbldap::bind"></a>
<pre>
############################
# Credential Configuration #
############################
# Notes: you can specify two differents configuration if you use a
# master ldap for writing access and a slave ldap server for reading access
# By default, we will use the same DN (so it will work for standard Samba
# release)
slaveDN="cn=Manager,dc=idealx,dc=org"
slavePw="secret"
masterDN="cn=Manager,dc=idealx,dc=org"
masterPw="secret"

</pre>

<a id="htoc45"></a>8.1.3 The samba configuration
file : /etc/samba/smb.conf

<pre>
# Global parameters
[global]
workgroup = IDEALX-NT
netbios name = PDC-SRV
#interfaces = 192.168.5.11
username map = /etc/samba/smbusers
enable privileges = yes
server string = Samba Server %v
security = user
encrypt passwords = Yes
min passwd length = 3
obey pam restrictions = No
ldap passwd sync = Yes
#unix password sync = Yes
#passwd program = /opt/IDEALX/sbin/smbldap-passwd -u %u
#passwd chat = "Changing password for*\nNew password*" %n\n "*Retype new password*" %n\n"
ldap passwd sync = Yes
log level = 0
syslog = 0
log file = /var/log/samba/log.%m
max log size = 100000
time server = Yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
mangling method = hash2
Dos charset = 850
Unix charset = ISO8859-1

logon script = logon.bat
logon drive = H:
logon home =
logon path =

domain logons = Yes
os level = 65
preferred master = Yes
domain master = Yes
wins support = Yes
passdb backend = ldapsam:ldap://127.0.0.1/
# passdb backend = ldapsam:"ldap://127.0.0.1/ ldap://slave.idealx.com"
# ldap filter = (&amp;(objectclass=sambaSamAccount)(uid=%u))
ldap admin dn = uid=samba,ou=Users,dc=idealx,dc=com
ldap suffix = dc=idealx,dc=com
ldap group suffix = ou=Groups
ldap user suffix = ou=Users
ldap machine suffix = ou=Computers
ldap idmap suffix = ou=Users
ldap ssl = start tls
add user script = /opt/IDEALX/sbin/smbldap-useradd -m "%u"
ldap delete dn = Yes
#delete user script = /opt/IDEALX/sbin/smbldap-userdel "%u"
add machine script = /opt/IDEALX/sbin/smbldap-useradd -t 5 -w "%u"
add group script = /opt/IDEALX/sbin/smbldap-groupadd -p "%g"
#delete group script = /opt/IDEALX/sbin/smbldap-groupdel "%g"
add user to group script = /opt/IDEALX/sbin/smbldap-groupmod -m "%u" "%g"
delete user from group script = /opt/IDEALX/sbin/smbldap-groupmod -x "%u" "%g"
set primary group script = /opt/IDEALX/sbin/smbldap-usermod -g "%g" "%u"

# printers configuration
printer admin = @"Print Operators"
load printers = Yes
create mask = 0640
directory mask = 0750
nt acl support = No
printing = cups
printcap name = cups
deadtime = 10
guest account = nobody
map to guest = Bad User
dont descend = /proc,/dev,/etc,/lib,/lost+found,/initrd
show add printer wizard = yes
; to maintain capital letters in shortcuts in any of the profile folders:
preserve case = yes
short preserve case = yes
case sensitive = no

[homes]
comment = repertoire de %U, %u
read only = No
create mask = 0644
directory mask = 0775
browseable = No

[netlogon]
path = /home/netlogon/
browseable = No
read only = yes

[profiles]
path = /home/profiles
read only = no
create mask = 0600
directory mask = 0700
browseable = No
guest ok = Yes
profile acls = yes
csc policy = disable
# next line is a great way to secure the profiles
force user = %U
# next line allows administrator to access all profiles
valid users = %U "Domain Admins"

[printers]
comment = Network Printers
printer admin = @"Print Operators"
guest ok = yes
printable = yes
path = /home/spool/
browseable = No
read only = Yes
printable = Yes
print command = /usr/bin/lpr -P%p -r %s
lpq command = /usr/bin/lpq -P%p
lprm command = /usr/bin/lprm -P%p %j

[print$]
path = /home/printers
guest ok = No
browseable = Yes
read only = Yes
valid users = @"Print Operators"
write list = @"Print Operators"
create mask = 0664
directory mask = 0775

[public]
comment = Repertoire public
path = /home/public
browseable = Yes
guest ok = Yes
read only = No
directory mask = 0775
create mask = 0664

</pre>

<a id="htoc46"></a>8.1.4 The OpenLDAP
configuration file : /etc/openldap/slapd.conf

<pre>
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/samba.schema

schemacheck on
lastmod on

TLSCertificateFile /etc/openldap/ldap.idealx.com.pem
TLSCertificateKeyFile /etc/openldap/ldap.idealx.com.key
TLSCACertificateFile /etc/openldap/ca.pem
TLSCipherSuite :SSLv3
#TLSVerifyClient demand

#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
suffix dc=idealx,dc=com
rootdn "cn=Manager,dc=idealx,dc=com"
rootpw secret
directory /var/lib/ldap
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq
index objectClass,uid,uidNumber,gidNumber,memberUid eq
index cn,mail,surname,givenname eq,subinitial

# users can authenticate and change their password
access to attrs=userPassword,sambaNTPassword,sambaLMPassword
by dn="cn=Manager,dc=idealx,dc=com" write
by self write
by anonymous auth
by * none
# all others attributes are readable to everybody
access to *
by * read
</pre>

<h3><a id="htoc47"></a>8.2 Changing the
administrative account (ldap admin dn in smb.conf
file)</h3>

<a id="change::manager"></a> If you don't
want to use the cn=Manager,dc=idealx,dc=com account
anymore, you can create a dedicated account for Samba and the
smbldap-tools scripts. To do this, create an account named
<em>samba</em> as follows (see section <a href="#add::user">4.2.1</a>
for a more detailed syntax) :
<pre>
smbldap-useradd -s /bin/false -d /dev/null -P samba
</pre>
This command will ask you to set a password for this account. Let's
set it to <em>samba</em> for this example. You then need to modify
configuration files:
<ul>
<li>file /etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf
<pre>
slaveDN="uid=samba,ou=Users,dc=idealx,dc=com"
slavePw="samba"
masterDN="uid=samba,ou=Users,dc=idealx,dc=com"
masterPw="samba"

</pre></li>
<li>file /etc/samba/smb.conf
<pre>
ldap admin dn = uid=samba,ou=Users,dc=idealx,dc=com

</pre>
don't forget to also set the samba account password in
secrets.tdb file :
<pre>
smbpasswd -w samba
</pre></li>
<li>file /etc/openldap/slapd.conf: give to the
<em>samba</em> user permissions to modify some attributes: this user
needs to be able to modify all the samba attributes and some others
(uidNumber, gidNumber ...) :
<pre>
# users can authenticate and change their password
access to attrs=userPassword,sambaNTPassword,sambaLMPassword,sambaPwdLastSet,sambaPwdMustChange
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by self write
by anonymous auth
by * none
# some attributes need to be readable anonymously so that 'id user' can answer correctly
access to attrs=objectClass,entry,gecos,homeDirectory,uid,uidNumber,gidNumber,cn,memberUid
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by * read
# somme attributes can be writable by users themselves
access to attrs=description,telephoneNumber
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by self write
by * read
# some attributes need to be writable for samba
access to attrs=cn,sambaLMPassword,sambaNTPassword,sambaPwdLastSet,sambaLogonTime,sambaLogoffTime,sambaKickoffTime,sambaPwdCanChange,sambaPwdMustChange,sambaAcctFlags,displayName,sambaHomePath,sambaHomeDrive,sambaLogonScript,sambaProfilePath,description,sambaUserWorkstations,sambaPrimaryGroupSID,sambaDomainName,sambaSID,sambaGroupType,sambaNextRid,sambaNextGroupRid,sambaNextUserRid,sambaAlgorithmicRidBase
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by self read
by * none
# samba need to be able to create the samba domain account
access to dn.base="dc=idealx,dc=com"
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by * none
# samba need to be able to create new users account
access to dn="ou=Users,dc=idealx,dc=com"
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by * none
# samba need to be able to create new groups account
access to dn="ou=Groups,dc=idealx,dc=com"
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by * none
# samba need to be able to create new computers account
access to dn="ou=Computers,dc=idealx,dc=com"
by dn="uid=samba,ou=Users,dc=idealx,dc=com" write
by * none
# this can be omitted but we leave it: there could be other branch
# in the directory
access to *
by self read
by * none

</pre></li>
</ul>

<h3><a id="htoc48"></a>8.3 known bugs</h3>

<ul>
<li>Option <em>-B</em> (user must change password) of
smbldap-useradd does not have effect: when
smbldap-passwd script is called, <em>sambaPwdMustChange</em>
attribute is rewrite.</li>
</ul>

<br/>
<ul>
<li><a id="note1"></a>1</li>
<a href="http://IDEALX.com/">http://IDEALX.com/</a>
</ul>




<br/>
<em>This document was translated from
LATEX by</em> <a href="http://pauillac.inria.fr/~maranget/hevea/index.html"><em>H
EVEA</em></a><em>.</em>
</div>
<div id="footer">
Copyright &copy;<a href="http://www.idealx.com/"> IDEALX S.A.S</a> 2003 - All rights reserved -
<a href="http://www.idealx.com/search.en.html" accesskey="3">Search</a>&nbsp; -
<a href="/accessibility.en.html">Keyboard shortcuts and accessibility</a>&nbsp;<br/><a href="http://validator.w3.org/check/referer" title="Markup validation for this page"><img src="/images/w3_xhtml11.png" alt="Standard-compliant XHTML" width="80" height="15"/></a><a href="http://jigsaw.w3.org/css-validator/check/referer" title="Style Sheet validation for this page"><img src="/images/w3_css2.png" alt="Standard-compliant CSS 2" width="80" height="15"/></a></div>
</body>
</html>
 
ÄÉÚÁÊÎ É ÒÁÚÒÁÂÏÔËÁ: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
ÔÅËÕÝÉÊ ÍÁÊÎÔÅÊÎÅÒ: Michael Shigorin