CentOS NFS configuration instructions

Source: Internet
Author: User

In CentOS, what are the requirements for NFS Directory operations? Don't worry. Let's first look at the basic concepts of NFS. NFS is short for Network File System, that is, Network File System. the Network File System is one of the file systems supported by FreeBSD, also known as NFS. NFS allows a system to share directories and files with its users on the network. By using NFS, users and programs can access files on the remote system just like accessing local files. How to install and configure nfs in the CentOS system is described below. First, we will introduce some CentOS system commands that will be used.

Start and Stop CentOS system services

Start the service

 
 
  1. # /etc/init.d/nfs start 

Stop Service

 
 
  1. # /etc/init.d/nfs stop 

Restart service

 
 
  1. # /etc/init.d/nfs restart 

CentOS system server configuration

1. Create a shared directory # mkdir/home/share

2. Create or modify the/etc/exports configuration file

The content of this file is very simple. Each line consists of the throw path, the list of Customer names, and the Access Options followed by each customer name:

[Shared directory] [host name or IP address (parameter, parameter)]

The parameters are optional. If no parameter is specified, nfs uses the default option. The default sharing options are sync, ro, root_squash, and no_delay.

In CentOS, when the host name or IP address is empty, it means that the service is shared to any client.

If you share the same directory with multiple clients but have different permissions for each client, you can:

[Shared directory] [host name 1 or IP1 (parameter 1, parameter 2)] [host name 2 or IP2 (parameter 3, parameter 4)]

Below are some common NFS sharing parameters: 

 
 
  1. Ro read-only access
  2. Rw read/write access
  3. Sync all data written for sharing upon request
  4. Async NFS can request data before writing data
  5. Secure NFS is sent through the secure TCP/IP ports below 1024
  6. Insecure NFS is sent over port 1024
  7. Wdelay if multiple users want to write data to the NFS Directory, write data to the group by default)
  8. No_wdelay if multiple users want to write data to the NFS Directory, write the data immediately. This setting is not required when async is used.
  9. Hide does not share its subdirectories in the NFS shared directory.
  10. No_hide shares the subdirectory of the NFS Directory
  11. Subtree_check if sub-directories such as/usr/bin are shared, force NFS to check the permission of the parent directory by default)
  12. No_subtree_check is opposite to the above. The parent directory permission is not checked.
  13. All_squash: The UID and GID of the shared file are mapped to the anonymous user anonymous, which is suitable for public directories.
  14. No_all_squash retains the UID and GID of the shared file by default)
  15. Root_squash all requests of the root user are mapped to the same permissions as those of the anonymous user by default)
  16. The no_root_squash root user has full management access permissions to the root directory.
  17. Anonuid = xxx specifies the UID of an anonymous user in the NFS server/etc/passwd file
  18. Anongid = xxx specifies the GID of anonymous users in the NFS server/etc/passwd file

The configuration file/etc/exports is as follows:

 
 
  1. $ cat /etc/exports  
  2.  
  3. /home/share 192.168.102.15(rw,sync) *(ro) 

In the CentOS system, nfs installation and configuration are complete, so that we can use NFS.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.