Install and configure NFS in CentOS

Source: Internet
Author: User
I. INTRODUCTION to NFSNFS NFS is full name: networkfilesystemNFS allows a system to share directories and files with others on the network. By using NFS, users and programs can access files on the remote system just like accessing local files. 1. to install and configure NFS (server), you must first install two packages (nfs-utils and rpcbind) yuminstall-ynf

I. NFS
NFS introduction
NFS stands for network file system.
NFS allows a system to share directories and files with others on the network. By using NFS, users and programs can access files on the remote system just like accessing local files.

1. install and configure NFS (server)

First, install two packages (nfs-utils and rpcbind)
Yum install-y nfs-utils

Yum install-y rpcbind

II. configure NFS

Edit vim/etc/exports

/Home/192.168.137.0/24 (rw, sync, all_squash, anonuid = 501, anongid = 501)

Add the preceding content

First, let's explain the meaning in (). This involves the suppression of client users by the NFS server, that is, permission settings.

Rw read/write

Ro read-only

Sync synchronization mode

Async not synchronized

All_squash limits all users. no matter who is using NFS, his identity will be limited to a specified normal user identity.

Root_squash limits the identity of a super-administrator user.

No_root_squash limits other users and does not limit the number of superpipes (security considerations during use)

Anonuid/anongid: used together with root_squash and all_squash to specify the uid and gid after the NFS user is used, provided that the uid and gid exist in the/etc/passwd of the local machine.

 

Then take a look at the section/home/192.168.3.0/24 (rw, sync, all_squash, anonuid = 501, anongid = 501) (adjust permissions as needed)

It consists of three parts:

The first part is the local directory to be shared/home/

The second part is the host that can be accessed (either an IP address or an IP segment), that is, 192.168.3.0/24.

The third part is in parentheses, which contains some permission options. (As explained above)

This section I wrote in/etc/exports/indicates that the shared directory is/home, the trusted host is the network segment 192.168.3.0/24, the permission is read/write, synchronization, all users are limited, and the uid and gid are both 501.

You can also open the root/home/192.168.3.0/24 (rw, sync, no_root_squash)


Then the server starts (pay attention to the order). check the limits in the firewall and selinux.

/Etc/init. d/rpcbind start;

/Etc/init. d/nfs start

 

Client Configuration

1. nfs-utils must be installed

2. after the installation is complete, run the command to check which Directory is shared by the server.

Showmount-e 192.168.3.3

3. shared directories can be mounted on the client.

This is the mount-t nfs-onolock, nfsvers = 3 192.168.3.3:/home/mnt

Let's take a look at the red-marked options.-onolock and nfsvers = 3 represent nfsvers 3 and prevent locking.

View

It is not successful to create a file at will under/mnt mounted on the client (see figure)

Here, because the owner group in the directory is root and we suppress all users on the server, even if the client is created using root, there is no permission. Either the user who changes the suppression can release the root account or use the account after adjusting the permissions for security reasons.

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.