0

I am using CentOS7. I have tried to test "autofs". I have created 2 centos servers as cent_ldap and cent_client. I have configured cent_client to use ldap authentication successfully. In cent_ldap I have created nfs export as

/home *(rw)

Using cent_client I have created

mkdir /mnt/fordirect -p

mkdir /mnt/forindirect -p

In the file /etc/auto.master.d/direct.autofs -> /- /etc/auto.direct

In the file auto.direct -> /mnt/fordirect -rw,sync cent_ldap:/home

In the file /etc/auto.master.d/indirect.autofs -> /mnt /etc/auto.indirect

In the file auto.indirect -> forindirect -rw,sync cent_ldap:/home

systemctl restart autofs autofs is started without any error

But when I test those mounts from root user

ls /mnt/fordirect --> user1 user2 user3

ls /mnt/forindirect --> #it didnt give any output

Can someone tell me why is there indirect mount didnt give any output?

0

If I recall correctly (I find autofs powerfull but confusing) it should work like this:

In the file /etc/auto.master.d/indirect.autofs:

/mnt/forindirect /etc/auto.indirect

And in /etc/auto.indirect:

* -rw,sync cent_ldap:/home/&

Then test with:

ls -l /mnt/forindirect/user1 /mnt/forindirect/user2 /mnt/forindirect/user3
  • I followed your instructions, after all when I have run the command <br> ls -l /mnt/forindirect/user1</br> then it gives me <br>ls: cannot open directory /mnt/forindirect/user1: Permission denied</br> but after i ran the command <br>ls -l /mnt/forindirect</br> it shows me full directory info – Randeer Lalanga Oct 2 '18 at 16:10
  • And it does not work? – Hkoof Oct 2 '18 at 16:14
  • after all when I have run the command <br> ls -l /mnt/forindirect/user1</br> then it gives me <br>ls: cannot open directory /mnt/forindirect/user1: Permission denied</br> but after i ran the command <br>ls -l /mnt/forindirect</br> it shows me full directory info – Randeer Lalanga Oct 2 '18 at 16:18
  • So, running ls -l caused autofs to mount correctly, but the uid that was running ls -l has no permission on the mounted directory on the server. – Hkoof Oct 2 '18 at 16:23
  • when I creating/editing those auto.* files do I want to use tab key or space key. I previously use tab key.but i didnt got any output like this. but in your way I got the answer, thanks man – Randeer Lalanga Oct 2 '18 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.