CentOS fragmentary learning little memory. Nfs

Source: Internet
Author: User

Long time no update, Today content NFS

one. NFS
Introduction to NFS
the NFS full name is the 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 as if they were accessing local files.

I. Installing and configuring NFS (server side)

Two packages (Nfs-utils and rpcbind) need to be installed first
Yum Install-y nfs-utils

Yum Install-y Rpcbind

Two. Configure NFS

Edit Vim/etc/exports

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

Join the section above

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/02/wKioL1XDdMfRYfV2AACNJUQoPDE264.jpg "title=" 1.png " alt= "Wkiol1xddmfryfv2aacnjuqopde264.jpg"/>

First explain the meaning of the (), here involves the NFS server to the client user's suppression, that is, the permission settings.

RW Read/write

RO Read Only

Sync Sync mode

Async out of sync

All_squash restrictions on all users, regardless of who is using NFS, his identity will be limited to a specified normal user identity

Root_squash restrict the user, his identity will be limited to a normal user identity

No_root_squash limit other users, no restrictions on the use of the Tube (safety is considered when using)

Anonuid/anongid: To be used with Root_squash and All_squash to specify a user-defined UID and GID using NFS, provided the UID and GID exist in the/etc/passwd of this machine.


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

Total is divided into three parts

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

I wrote this section in/etc/exports/it means: The shared directory is/home, the trusted host is 192.168.3.0/24 this network segment, the permissions are read and write, synchronized, limited to all users, and the qualified UID and GID are 501.

can also be written to release root   /HOME/192.168.3.0/24 (Rw,sync,no_root_squash)    


then start the server (pay attention to the order) remember to check the firewall restrictions and selinux 

/etc/init.d/rpcbind start;

 /etc/init.d/nfs start 


Configuration of the Client

1. nfs-utils    must be installed;

2. After the installation is complete, you can use the view command to see which directory is shared by the server.

showmount-e 192.168.3.3

3. The shared directory can be mounted on the client

This is the Mount-t NFS -onolock,nfsvers=3 192.168.3.3:/home/mnt

Focus on the Red option,-onolock,nfsvers=3 represents the Nfsvers 3 version and prevents locking

See

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/71/02/wKioL1XDe_uBrpv2AAD0vhydQA0002.jpg "title=" 2.png " alt= "Wkiol1xde_ubrpv2aad0vhydqa0002.jpg"/>

It is not successful to create a file at random on the client to enter the Mount/mnt (see image)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/02/wKioL1XDfMeTd1DNAADg0UokDfo727.jpg "title=" 3.png " alt= "Wkiol1xdfmetd1dnaadg0uokdfo727.jpg"/>

This is because the main group of directories is root and because we suppress all users on the server, even if the client is created with root, it does not have permissions. Either change the suppressed user to release root or use it for security reasons after adjusting the permissions.





CentOS fragmentary learning little memory. 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.