Centos 7 build nfs service

NFS(network file system)

lab environment:

You need two machines:

node1.cn    192.168.1.111------server

node2.cn    192.168.1.222------client

 

Configuration file: / etc / exports (empty file, all hand-written)

Profiles divided into two parts

Left-bit shared directory name (shared resources), the right for the parameter options

 

Server configuration steps:

1. Create a shared directory (the size of the shared directory for its size which partition)

mkdir / mnt / nfs

2. Edit Profile

vim /etc/exports

 / Mnt / nfs 192.168.1.0/24(rw,sync) -> There are many options here parameters

       rw: readable and writable

       sync: synchronize when writing

3. Restart Service

      systemctl restart rpcbind

      systemctl restart nfs

4. Check whether the shared success

      exportfs -v -> displays shared details

      # If the share fails, try to execute the command

       exportfs -r -> reread nfs configuration (/ etc / exports)

5. Set permissions to the shared directory

      chmod 777 / mnt / nfs -> without proper file permissions, clients can not write data

 

The client (Linux) Configuration steps:

1. Check the network share

      showmount -e 192.168.1.111

2. Mount

      mount -t nfs 192.168.1.111:/mnt/nfs /mnt/

3. Check whether to mount a successful

      df -h

 

The client (windows) configuration steps:

1. Open the Control Panel

win + R

control

2. Open the program options, click Programs and Features

3. Open the windows startup or shutdown function

Find the NFS Service

Check the NFS client and management tools

4. Open cmd, and see whether the start rpc

showmount -e 192.168.1.112

5. Mount

      mount 192.168.1.111:/mnt/nfs H:

      The network storage // nfs mount the drive H:

 

Extended:

Nfs service system users uid is 65534, the user name nfsnobody

When the root system of different write files on the nfs server, the default file owner and the group that owns are nfsnobody

nfs service company belonging sun

nfs protocol: rpc -> remote procedure calls, use port number 111

 

Profile parameter options:

ro: directory read-only
rw: read-write directory
sync: synchronize data written to disk and memory buffers, low efficiency, but can ensure the consistency of data
async: the first data stored in the memory buffer, write only when necessary the disk
all_squash: all ordinary users and the respective group of remote access are mapped to an anonymous user or user group (nfsnobody)
no_all_squash: and all_squash negated (the default setting)
root_squash: the root user and the respective groups are mapped to an anonymous user or users group (the default setting)
no_root_squash: and rootsquash negated
anonuid = xxx: all users remote access are mapped to the anonymous user, and specify that the user is a local user (UID = xxx)
anongid = xxx: all the user groups remote access They are mapped to the anonymous user account group

 

Permissions:

General authority

Special privileges

selinux ------ context / sebool value

Extended permission

.config rights (rights profile)

Guess you like

Origin www.cnblogs.com/holinux/p/11070092.html