- Title: Configure a plain Ubuntu client for LDAP authentication and pam_mount for mounting the home folder
- Author(s): Udo Burghardt
- Date: 10. Nov. 2012
- Version: 0.9 (re-validation required)
- Zentyal profiles: Office (requires zentyal-samba)
- Tested with Server: zentyal-core 3.0.5, zentyal-samba 3.0.6
Hint inserted March 2014: NOT confirmed to work on Zentyal 3.2 and on Zentyal 3.3 - Tested with Client: Ubuntu 12.10. (Will work with other not-too-old Ubuntu releases too. Other distributions might have other packages and other configuration files.)
Hint inserted April 2014: positive confirmed to work with Xubuntu 14.04 as a client with Zentyal 3.0.x
IntroductionThe goal is to use LDAP for authentification and pam_mount to mount user's $HOME during logon on a plain Ubuntu client. In this Howto
this is done by command line only. (Command line might be a Terminal on the graphical Desktop of course.)
Requisite- one machine is running Zentyal Server
- another machine is the client we are configuring now
- you know the IP addresses of both machines and "ping" in both directions does work
- Zentyal allows connection to Port 390 (LDAP). Configuration via Web Gui Firewall - Paketfilter
On the clientOpen a Terminal and run
sudo -i as all the following command require root.
lu@client:~$ sudo -i
[sudo] password for lu:
root@client:~#
This prompt is shortened to
~# for being root from now on.
~# apt-get update && apt-get dist-upgrade
~# apt-get install ssh
~# reboot
After this you might run the following through an ssh session. While this is absolutely not required it is my usual way to work. Alternatively you might continue using "Terminal" on the Desktop.
Ldap~# apt-get install libnss-ldap libpam-ldap libpam-mount winbind smbclient cifs-utils ldap-utils
# ignore all requested user input, simple hit "enter"
~# cd /etc
~# rm ldap.conf
~# rm ldap/ldap.conf
Use you favorite
$EDITOR to create the file
/etc/ldap.conf with a content like the following block. To achieve this compact listing I used the command
grep -v ^# ldap.conf | uniqbase dc=neo,dc=lan
uri ldap://10.1.100.1:390
ldap_version 3
binddn cn=zentyalro,dc=neo,dc=lan
bindpw jw4xF8KRS@IsEqxCbt=0
scope sub
bind_policy soft
pam_password md5
nss_base_passwd ou=Users,dc=neo,dc=lan?one
nss_base_passwd ou=Computers,dc=neo,dc=lan?one
nss_base_shadow ou=Users,dc=neo,dc=lan?one
nss_base_group ou=Groups,dc=neo,dc=lan?one
nss_schema rfc2307bis
nss_map_attribute uniqueMember member
nss_reconnect_tries 2
nss_initgroups_ignoreusers avahi,avahi-autoipd,backup,bin,colord,daemon,games,gnats,hplip,irc,kernoops,libuuid,lightdm,list,lp,mail,man,messagebus,news,proxy,pulse,root,rtkit,saned,speech-dispatcher,sshd,sync,sys,syslog,usbmux,uucp,whoopsie,www-data
Remarks:- base - see "Users and Groups - LDAP settings - LDAP information - Base DN (in the Zentyal web frontend)
- uri - use the IP address of your Zentyal box and Port 390 to reach Ldap
- binddn - run grep ^binddn /etc/ldap.conf on your Zentyal server's shell
- bindpw - run grep ^bindpw /etc/ldap.conf on your Zentyal server's shell
To tell the command line tool
ldapsearch to use the same settings create a link:
~# ln -s /etc/ldap.conf /etc/ldap/ldap.conf
At this point the first check is useful. My userid on the Zentyal server is "
ubt" and I want to know my where my
homeDirectory is:
~# ldapsearch -D "uid=ubt,ou=Users,dc=neo,dc=lan" -LLL -W uid=ubt homeDirectory
Enter LDAP Password:
dn: uid=ubt,ou=Users,dc=neo,dc=lan
homeDirectory: /home/ubt
Omit the last parameter to get a much longer list of settings.
Name Service SwitchNSS converts usernames (and other information) into numerical IDs and vice versa. To let Ubuntu figure out that the user "
ubt" has the numerical id 2003 we need to run:
~# auth-client-config -t nss -p lac_ldap
Now the system knows:
~# id ubt
uid=2003(ubt) gid=1901(__USERS__) groups=1901(__USERS__)
From now on "
ssh ubt@client" works - but you do not get access to
$HOME as it gets not mounted yet.
Mount $HOMEAdd a line in
/etc/security/pam_mount.conf.xml below
<!-- Volume definitions -->:
<volume user="*" fstype="cifs" server="10.1.100.1" path="%(DOMAIN_USER)" mountpoint="/home/%(DOMAIN_USER)" options="sec=ntlm,nodev,nosuid" />
Replace
10.1.100.1 with the IP address of your Zentyal box.
Test it. The initial connect via ssh requires the acceptance of the up until now unknown key/fingerprint:
~# ssh ubt@client
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 38:53:9a:d6:4d:9e:ef:ab:a9:58:63:d2:ac:f3:91:c2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
ubt@client's password:
Welcome to Ubuntu 12.10 (GNU/Linux 3.5.0-18-generic i686)
* Documentation: https://help.ubuntu.com/
ubt@client:~$ pwd
/home/ubt
ubt@client:~$ ls
Pictures Desktop Documents Downloads
That's it. Login will also work running the GUI login on the client.
Authors note: Initially I intended to put this into the community wiki as a user generated documentation snippet. Unfortunately I do not understand trac.../wiki. Most pages are read only - even the Sandbox (stating "Go ahead, edit it freely.") - and it is unclear
where and how to add pages. At the end I was not sure if this specific kind of doc is welcome. Probably the quality level should be higher there, so I put it here. May it be read or ignored, at least
I know where to look for this info when I prepare my next computer

Added 25. July 2013 on page 4: modifications for debian (Wheezy called Raspbian on Raspberry Pi).