LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-18-2015, 11:30 AM   #1
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Rep: Reputation: 62
OpenLDAP user authentication and automounting home directory.


I've almost got this working. I have successfully logged in a user via OpenLDAP rather than a local user. But now, I want to use NFS/AutoFS to auto-mount that user's home directory.

I used the migration tools to export local users (of which "ldapuser1" is included in) so the ldapuser1 user has a /home/ldapuser1 home directory on the server. I export the /home directory under /etc/exports with: -

Code:
/home           192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)
On the client, I used the following authconfig command to enable LDAP authentication: -

Code:
authconfig --enableldap --enableldapauth --ldapserver='ldap://ldapserver.example.local/' --ldapbasedn='dc=example,dc=local' --enablemkhomedir --enableshadow --enablelocauthorize --passalgo=sha256 --update
In /etc/auto.master I added: -

Code:
/home   /etc/auto.home
...and the /etc/auto.home file contains: -

Code:
*       -fstype=nfs    192.168.1.81:/home/&
where the IP address is the IP address of the LDAP server.

The autofs and nslcd services are running and SELinux is disabled. When I now login through localhost with the user that only exists on the LDAP server, I get: -

Code:
    [root@client etc]# ssh ldapuser1@localhost
    ldapuser1@localhost's password:
    Creating directory '/home/ldapuser1'.
    Unable to create and initialize directory '/home/ldapuser1'.
    Last login: Wed Mar 18 11:23:04 2015 from localhost
    Could not chdir to home directory /home/ldapuser1: No such file or directory
    -bash-4.1$
There isn't anything in /var/log/messages, but /var/log/secure has this: -

Code:
    Mar 18 11:23:41 client sshd[1427]: Accepted password for ldapuser1 from ::1 port 55712 ssh2
    Mar 18 11:23:41 client mkhomedir_helper: PAM unable to create directory /home/ldapuser1: Permission denied
    Mar 18 11:23:41 client sshd[1427]: pam_unix(sshd:session): session opened for user ldapuser1 by (uid=0)
    Mar 18 11:24:33 client sshd[1432]: Received disconnect from ::1: 11: disconnected by user
    Mar 18 11:24:33 client sshd[1427]: pam_unix(sshd:session): session closed for user ldapuser1
So PAM is unable to create the directory with 'permission denied' error. However, if I stop the autofs service and login, LDAP creates the user's home directory for me, but it's empty of the files that are present on the LDAP server's user home directory.
If I start the autofs service and try and create the user's home directory manually, I also get "permission denied" even though I am root and the file permissions look okay so it looks as though autofs has some sort of lock on the client's /home directory.

All I want to do is login via LDAP (which works currently) and auto-mount the /home/ldapuser1 directory on the client so that the user has everything centralised on the LDAP/NFS server.

Am I doing it wrong?
 
Old 03-19-2015, 05:02 PM   #2
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
Your authconfig command included '--enablemkhomedir', which says you want to make home directories not automount them. Disable that option, and restart the automounter.
 
1 members found this post helpful.
Old 03-22-2015, 07:14 PM   #3
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
Thanks. I removed that and also renamed the client /home directory. Appears to have fixed it.
 
  


Reply

Tags
authentication, automount, home directory, openldap



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenLDAP and Microsoft Active Directory pass through authentication ragga Linux - Newbie 8 07-10-2014 04:18 PM
replacing Openldap for centralized authentication instead of Active directory Narayandutt Linux - Software 1 08-23-2007 11:36 AM
Automounting user home directories over local network. X_user Linux - Networking 8 07-21-2007 03:04 PM
nis home directory automounting ravi_foru Linux - Networking 2 03-06-2006 09:12 AM
automounting in /home directory doesn't work jlinkels Linux - Software 3 03-18-2005 05:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration