3

I'm trying to set an nfs automount with ldap in a folder other than /home.

It turns out that autofs always mounts in /home, no matter what.

I tried many configurations from the web, including from redhats but they all failed to mount the nfs export in /ldap directory.

despite /ldap folder is created it is not accessible even by root user.

Am I missing something? Should Server-side allow something specific? or is this a bug?

Linux distro: CentOS 7.0

STEPS TOOK:

  1. make directory for ldap users mounts

    mkdir /ldap
    
  2. enable LDAP with authconfig-tui

    authconfig-tui
    
  3. install autofs

    yum -y install autofs
    
  4. allow home directory creation

    authconfig --enablemkhomedir --updateall 
    
  5. update auto.master file (direct mapping)

    /misc /etc/auto.misc
    /-    /etc/auto.map   #Inserted Line
    /net  -hosts
    +dir:/etc/auto.master.d
    +auto.master
    

    auto.misc (untouched)

    cd    -fstype=iso9660,ro,nosuidmnodev :dev/cdrom
    
  6. update auto.map file (created by me)

    /ldap    -fstype=nfs   server:/home/&
    
  7. restart autofs

    systemctl restart autofs
    
  8. login with ldap user

    su - ldapuser
    

Additional Info

on 4) I've tried both with --disablemkhomedir and with --enablemkhomedir. When using disablemkhomedir I get an error that was not possible to change to home/user directory. Even though I configured /ldap. What would make sense to me would be /ldap/ldaupuser1.

su: warning: cannot change directory to /home/ldapuser1: No such file or directory

on 7) the /ldap folder is created but I can't access the folder, even with root user. it displays:

cd /ldap 
-bash:cd: /ldap: No such file or directory

getent passwd ldapuser

ldapuser:*:200044:200044:LDAPUSER 1:/home/ldapuser:/bin/bash
5
  • 1
    Can you show all the non-comment lines from auto.master and auto.misc please. And have you edited auto.map at all, or is that standard? Mar 31, 2019 at 8:51
  • You've got automatic home directory creation, which will be under /home, but you're mounting users' directories under /ldap. Is there a piece of the puzzle you've not shared with us, or is this part of the problem? Mar 31, 2019 at 8:55
  • Hi @roaima, I have updated the post with complete uncommented auto.master,misc and map. you mean that --enablemkhomedir can be causing the problem? I've tried both with --disablemkhomedir and with --enablemkhomedir. when using disablemkhomedir. I get an error that was not possible to create home/user directory.
    – Nelssen
    Mar 31, 2019 at 9:35
  • Please add the output of getent passwd ldapuser1 to your question.
    – Thomas
    Mar 31, 2019 at 15:48
  • Hi @Thomas, I've added the requested output!
    – Nelssen
    Apr 3, 2019 at 6:35

1 Answer 1

3

I have two options for your , that i think might work in this scenario.

Solution1: ON IPA SERVER:

# ipa user-mod ldapuser --homedir=/home/guests/ldapuser

change the home directory on of the user on the ipa server and then try to mount from the ipa client... it should ask you to mount into different directory.

Solution 2: ON IPA Client

[root@client1 /]# showmount -e <SERVERIP>
Export list for <SERVERIP>
/home/guests *

#cat /etc/auto.master
/misc   /etc/auto.misc
/mnt   /etc/auto.nfs   <---- add this line to mount under home locally

create this file for nfs.

[root@client1 /]# cat /etc/auto.nfs
*       -fstype=nfs,rw,vers=3   192.168.20.100:/home/guests/&
5
  • Hi @Asif Shabbir, it doens't work either. the directory is still mounted in /home/
    – Nelssen
    Apr 5, 2019 at 7:12
  • Have you installed NFS server . Are you able to mount NFS using mount command. I have tested above configuration and it worked for me. Apr 7, 2019 at 7:52
  • Try changing this line .. /ldap -fstype=nfs server:/home/&. . to this and check the effect . /ldap/* -fstype=nfs server:/home/& Apr 7, 2019 at 7:54
  • Hi @Asif Shabbir, Sorry for the late reply, I only had access to the client side.But I Managed to install FreeIPA, and I'll try the solution 1. However I wanted to know if it was possible to achieve without changing the server. thank you for the help so far
    – Nelssen
    May 5, 2019 at 7:08
  • and yes, I can mount the NFS directory manually
    – Nelssen
    May 5, 2019 at 7:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .