[Project case] an NFS server is set up in a library and the output directory is configured as follows (1) open the/nfs/share directory for all users to view the information. (2) open the/nfs/upload directory as the data upload Directory for the 192.168.1.0/24 network segment, and map all users and user groups to nfs-upload, the UID and GID are both 300. (3) share the/home/tom directory to the host 192.168.1.87, and only use
[Project case] A library sets up an NFS server and configures the output directory according to the following requirements:
(1) open the/nfs/share directory for all users to view their materials.
(2) open the/nfs/upload directory as the data upload Directory for the 192.168.1.0/24 network segment, and map all users and user groups to nfs-upload, the UID and GID are both 300.
(3) share the/home/tom directory with only the host 192.168.1.87, and only the user tom can access the directory completely.
[Configuration Implementation]
1) create a directory:/nfs/share,/nfs/upload,/home/tom
[Root @ server ~] # Useradd tom # create the user tom and the/home/tom Directory
2) modify the/nfs/upload directory permission and create a nfs ing user nfs-upload
3) Check whether NFS-utils and portmap are installed before configuring nfs)
As shown in, nfs-utils and portmap have been installed.
4) edit the nfs master configuration file
[Root @ server ~] # Vim/etc/exports
5) write test files to the three directories respectively.
[Root @ server ~] # Touch/nfs/share/sh
[Root @ server ~] # Touch/nfs/upload/up
[Root @ server ~] # Touch/home/tom/ho
6) start NFS-related services
------------------- Client ------------------
Showmoutn-e 192.168.1.87
Mkdir/share
Mkdir/upload
Mkdir/tom
Mount 192.168.1.87:/nfs/share
Mount 192.168.1.87:/nfs/upload
Mount 192.168.1.87:/home/tom
Df
Ls/share
Ls/upload
Ls/tom
Touch/share
Touch/upload
Touch/tom
Su-tom
Touch/tom
Su
Id tom
Useradd-u501 tom
Id tom
Su-tom
Touch/tom/tom2
Ls-l/upload/
Su
Touch/upload/root
Ls-l/upload/
---------------------------- Server -----------------------
Ls-l/nfs/upload/
Vim/etc/exports
/Nfs/share * (ro)
/Nfs/upload 192.168.1.0/24 (rw, anonuid = 300, anongid = 300)
/Home/tom 192.168.1.86 (rw)
Service portmap restart
Service nfslock restart
Service nfs restart
---------------------------- Client ---------------------
Mount-o remount/upload/
Touch/upload/root2
Su tom
Touch/upload/tom2
Ls-l/upload/
---------------------------- Server -----------------------
Cat/var/lib/nfs/etab