AutoFS Automatic Mount Service
Requirement: Make the following two commands automatic mount
172.16.2.6:/share/soft/share/soft
172.16.2.6:/share/iso/share/iso
Client:
1.yum-y Install AutoFS
2, # Mkdir/share (Mount point)
3. # Vim/etc/auto.master
/share/etc/auto.share--This file does not exist later, the custom name
4. # Vim/etc/auto.share
Soft-172.16.2.6:/share/soft
Iso-172.16.2.6:/share/iso
5, #/etc/init.d/autofs Restart --Restart service
Attention:
--mount the directory by default in the/share directory with the LS command can not be seen, but may cd/share/iso in, this will help you automatically mount
After about five minutes, if not used, will automatically umount off
The primary configuration file is in/etc/auto.master, where the format is:
Mount Directory Map File parameters
/share/etc/auto.share--timeout=60
Mount a directory, that is, where is it mounted?/mnt or otherwise, this is specified by default/share
Mapping file, AutoFS is how to find the mounted device where? The above mount Directory is just a general directory, CDROM,FLOPPY,NFS,SMBFS files are attached to a/share, then how to divide the clear? So the AOTUFS program will automatically generate a mount point directory in the Mount directory, where the mapping file specifies the directory name, the mapping file format (here is:/etc/auto.share file content):
Sub-directory name mount option mount device
Soft-fstype=iso9660,ro:/dev/cdrom #注意冒号
Iso-fstype=auto:/dev/floppy
The mounted device can be a network path, for example 192.168.100.195:/opt/wwwroot
PS: A writing example of a map file
To mount the configuration of samba:
BACKUP-FSTYPE=CIFS,USERNAME=SMBUSER1%ASDF://192.168.1.99/pub
To mount the ISO configuration:
Iso-loop,fstype=iso9660,ro:/root/rhel-server-6.0-x86_64-boot.iso
Mount NFS Configuration:
Nfs-fstype=nfs 192.168.1.99:/test_nfs
Server: NFS Portmap (rhel6 to be called rpcbind), build see NFS Servers detailed configuration
1. # showmount-e 172.16.2.6
Clnt_create:RPC:Port Mapper failure-unable Toreceive:errno 111 (Connection refused)
2. #/etc/init.d/rpcbind start (Start Rpcbind to start NFS service)
3, #/etc/init.d/nfs Restart--restart NFS, register the new RPC
4, # showmount-e172.16.2.6--Again OK
Server for NFS configuration file: Vim/etc/exports
Parameters:
RO Read Only
RW Readable and writable
Root_squash on behalf of the client to Nfsnobody user mount, default does not write
No_root_squash on behalf of the client with root user mount
Sync synchronization
Async Async
Master configuration file: Vim/etc/exports
/share/iso * (RO)--Share the/share/iso to * (on behalf of all IP) RO (for Read only)
/share/iso * (rw)--RW representative readable writable
/share/iso 10.1.1.0/24 (RO)--computer access only for network segments shared with 10.1.1
/share/iso 10.1.1.0/255.255.255.0 (RO)
/share/iso 10.1.1.218/255.255.255.255 (RO)--Define only 10.1.1.218 this machine can access
/share/iso 10.1.1.218 (RO)
/share/iso 10.1.1.218/32 (RO) 10.1.1.254/32 (rw)--Define only 218 and 254 these two can be accessed
About NFS Permissions:
The permissions of the client mount directory to the server-side shared directory
The default permission for the NFS service shared directory is to mount the Nfsnobody user.
There's a sentence under the/etc/passwd.
Nfsnobody:x:65534:65534:anonymous Nfsuser:/var/lib/nfs:/sbin/nologin
Note: If the service is done, the permissions of the service and the permissions of the system are combined to take effect:
That is, the client can access, requires firewall permission, the service allows, system permissions allow, to access
Linux_aotufs Auto Mount