autofs简介
来源:互联网 发布:福顺达对讲机写频软件 编辑:程序博客网 时间:2024/05/02 01:07
autofs简介
mount是用来挂载文件系统的,可以在系统启动的时候挂载也可以在系统启动后挂载。对于本地固定设备,如硬盘可以使用mount挂载;而光盘、软盘、NFS、SMB等文件系统具有动态性,即需要的时候才有必要挂载。光驱和软盘我们一般知道什么时候需要挂载,但NFS和SMB共享等就不一定知道了,即我们一般不能及时知道NFS共享和SMB什么时候可以挂载。而autofs服务就提供这种功能,好像windows中的光驱自动打开功能,能够及时挂载动态加载的文件系统。免去我们手动载在麻烦。要实现光驱,软盘等的动态自动挂载,需要进行相关的配置。后面我们就给出配置的方法。
autofs配置
autofs的主要配置文件有两个,分别是/etc下的auto.master和auto.misc。其中,auto.master是起控制作用的,它定义了挂在点和automount动作的文件。其内容如下:
## $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $## Sample auto.master file# This is an automounter map and it has the following format# key [ -mount-options-separated-by-comma ] location# For details of the format look at autofs(5).#/misc /etc/auto.misc #/misc是定义的自动mount的挂载点,/etc/auto.misc里定义了mount的动作/home /etc/auto.home #/home是定义的自动mount的挂载点;/etc/auto.home定义了mount的动作, #此文件系统默认不存在,需要我们手工创建。/net -hosts## Include central master map if it can be found using# nsswitch sources.## Note that if there are entries for /net or /misc (as# above) in the included master map any keys that are the# same will not be seen as the first read key seen takes# precedence.#+auto.master
/etc/auto.misc的内容如下:
## $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $## This is an automounter map and it has the following format# key [ -mount-options-separated-by-comma ] location# Details may be found in the autofs(5) manpagecd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom #将/dev/cdrom自动挂载到/misc/cd/下# the following entries are samples to pique your imagination#linux -ro,soft,intr ftp.example.org:/pub/linux #将ftp.example.org的共享目录 #/pub/linux/自动挂载到/misc/linux/下#boot -fstype=ext2 :/dev/hda1 #将本地磁盘分区/dev/hda1自动挂载到/misc/boot下#floppy -fstype=auto :/dev/fd0 #将软盘设备/dev/fd0自动挂载到/misc/floppy下#floppy -fstype=ext2 :/dev/fd0#e2floppy -fstype=ext2 :/dev/fd0#jaz -fstype=ext2 :/dev/sdc1#removable -fstype=ext2 :/dev/hdd
要访问上面的automount资源,可以用如下命令:
#ls /misc/cd/#ls /misc/linux/#ls /misc/boot/#ls /misc/floppy/
这些资源只有在你试图访问的时候才会去自动挂载,而在一段时间之后,如果你不再使用这些资源,autofs会自动卸载这些资源。默认时间为5分钟(300秒),此选项由/etc/sysconfig/autofs定义,根据需要可以修改。/etc/sysconfig/autofs的内容如下:
## Define default options for autofs.## DEFAULT_MASTER_MAP_NAME - default map name for the master map.##DEFAULT_MASTER_MAP_NAME="auto.master"## DEFAULT_TIMEOUT - set the default mount timeout (default 600).#DEFAULT_TIMEOUT=300## DEFAULT_BROWSE_MODE - maps are browsable by default.#DEFAULT_BROWSE_MODE="no"## DEFAULT_LOGGING - set default log level "none", "verbose" or "debug"##DEFAULT_LOGGING="none"## Define the default LDAP schema to use for lookups## System default##DEFAULT_MAP_OBJECT_CLASS="nisMap"#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"#DEFAULT_MAP_ATTRIBUTE="nisMapName"#DEFAULT_ENTRY_ATTRIBUTE="cn"#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"## Other common LDAP nameing##DEFAULT_MAP_OBJECT_CLASS="automountMap"#DEFAULT_ENTRY_OBJECT_CLASS="automount"#DEFAULT_MAP_ATTRIBUTE="ou"#DEFAULT_ENTRY_ATTRIBUTE="cn"#DEFAULT_VALUE_ATTRIBUTE="automountInformation"##DEFAULT_MAP_OBJECT_CLASS="automountMap"#DEFAULT_ENTRY_OBJECT_CLASS="automount"#DEFAULT_MAP_ATTRIBUTE="automountMapName"#DEFAULT_ENTRY_ATTRIBUTE="automountKey"#DEFAULT_VALUE_ATTRIBUTE="automountInformation"## DEFAULT_AUTH_CONF_FILE - set the default location for the SASL# authentication configuration file.##DEFAULT_AUTH_CONF_FILE="/etc/autofs_ldap_auth.conf"## General global options##OPTIONS=""
autofs应用
我们在网络管理部分介绍了NIS,在NIS实验部分,我们虽然能够以服务器上的帐号在客户端成功登陆。但是,系统会提示找不到那个用户的主目录。因为帐号是服务器上的,它的主目录也在服务器的/home下,我们要想使此帐户能够在客户端登陆并且能够在其主目录下读写文件,就需要将服务器上/home目录export出来,客户端还需要能够自动挂载此目录。
1、服务器端共享/home目录
修改/etc/exports:
/home *(rw)
2、客户端配置automount
修改/etc/auto.master,添加一行:
/home /etc/auto.home
在/etc下创建auto.home,并写入一行:
* -rw,soft,intr 172.16.78.142:/home/&
3、再用nisuser从客户端登陆,看看是否有主目录了。
- autofs简介
- autofs
- autofs用户指南
- automount and autofs
- autofs配置小结
- autofs 自动挂载.
- automount和autofs
- autofs 自动挂载
- AutoFS 配置方法
- autofs配置小结
- Linux_RHEL7_LDAP、Autofs服务
- Linux_NIS+NFS+Autofs
- Linux_LDAP+NFS+autofs
- autofs 自动挂载
- Nis+Nfs+Autofs
- autofs自动挂载
- linux nfs,autofs配置
- NIS服务器集中认证+autofs
- STL学习笔记-stack容器(栈)
- 多线程解析20151021
- window.location.reload与window.location.href
- 思维盛宴之设计模式-构建者模式Builder Pattern
- 为什么虚构函数不允许抛出异常
- autofs简介
- mysql sql优化实例1(force index使用)
- Java中的关键字和标识符
- sicily 1381. a*b
- [LeetCode]Pascal's Triangle
- 17.用JavaScript实现如下效果:一个div的宽度从其初始宽度1px,每秒增长1px,直到变到100px,再从100px每秒减少1px,直到变回到1px,如此反复5次后,该变化停止,并将其最
- 通过Java插入MYSQL的DATETIME类型
- ORA-02020的处理,dblink超出数量的设置
- 达内学习日志Day30:分组查询