NFS server installation testing

NFS network file system that allows network resource sharing computer network through TCP / IP protocol.

Software Installation:

$ sudo apt-get install nfs-kernel-server

(1) server

1) Create a shared directory

Use the command line to create a shared directory:

$ mkdir /home/xxx/filename

2) modify the configuration file

Configuration file format: <output directory> Client (Option: access, user mapping, other)

Output directory: file system to the client system using NFS as defined in

Client: NFS network that can access the shared IP address or domain name directory, commonly used to specify the way

Host a) specify the ip address: 192.168.100.1

b) specify a subnet: 192.168.100.0/24 can also be written as: 192.168.100.0/255.255.255.0

Host c) specify the domain name: david.bsmart.cn

All hosts d) specified domain:. * Bsmart.cn

e) all hosts: *

Options: used to set the output directory access permissions, user mapping, there are three types of options

1) shared file access options

ro: read-only set the output directory

rw: Set output directory read

2) User mapping options

all_squash: all ordinary users remote access and belongs to the group are mapped to an anonymous user or user group (nfsnobody)

no_all_squash: all_squash and negated (default)

root_squash: the root user and the respective groups are mapped to an anonymous user or user group (the default setting)

no_root_squash: negated and rootsquash

anonuid = xxx: all remote access users are mapped to anonymous, and specify the user as a local user (UID = xxx)

anongid = xxx: remote access to all user groups are mapped to the anonymous user account groups, and assign the anonymous user group accounts for the local user group account (GID = xxx)

3) other options

secure: Client restrictions only grew in 1024 tcp / ip port nfs server (the default setting)

insecure: allow the client from tcp / ip is larger than the server port 1024

sync: synchronize data written to the disk buffer memory, the efficiency is low, but you can guarantee data consistency

async: the first data stored in the memory buffer, is written to disk only when necessary

wdelay: Check for related write operation, if there will be performed together these writes, this can improve efficiency (the default setting)

no_wdelay: if a write operation is performed immediately, should be used in conjunction with sync

subtree: If the output directory is a subdirectory, then the nfs server will check the permissions of the parent directory (the default setting)

no_subtree: even if the output directory is a subdirectory, nfs server does not check the permissions of the parent directory, which can improve efficiency

NFS configuration routine is shown below

Open the configuration file:

$ sudo vim /etc/exports

Write the absolute path to the shared directory:

Finally, add the directory path in the configuration file, for example,

/ home / xxx / filename * ( rw, sync, no_root_squash) 
meaning: 
  RO: read-only access 
  rw: read and write permissions 
  sync: synchronize data is written to memory and hard disk 
  no_root_squash: not the root user and the respective groups are mapped to anonymous users or groups 
  *: representatives of IP addresses

Configuration is complete, save the configuration file.

3) Restart Service

$ sudo service nfs-kernel-server restart

(2) Client

1) mount the shared directory server

$ Mount IP (server IP address): a shared directory (/ home / xxx / filename) / mnt

2) Basic Operation

After successfully mount the shared directory, you can enter into the / mnt perform basic file operations

Guess you like

Origin www.cnblogs.com/Cqlismy/p/11058710.html