天天看點

RHCE7.0答案之Autofs自動挂載

Autofs自動挂載:

yum -y install autofs

vim /etc/auto.master  在檔案中添加下面行

/home/guests /etc/auto.tianyun

vim /etc/auto.tianyun 子挂載點監控

ldapuser0 -rw,sync classroom:/home/guests/ldapuser0

systemctl enable autofs.service

systemctl restart autofs.service

ls /home/guests  自動建立父挂載點

ls /home/guests/abc  被監控,目标檔案不存在

測試 ssh ldapuser0@localhost, 要是再使用ldapuser1呢,則家目錄又沒有挂載了,那怎麼辦呢?

autofs自動挂載使用者家目錄:

vim /etc/auto.tianyun, 添加 * -rw,sync classroom:/home/guests/&

vim /etc/sysconfig/autofs  TIMEOUT=300

本文轉自 拾瓦興閣 51CTO部落格,原文連結:http://blog.51cto.com/ponyjia/1866547