Linux--nfs Network file sharing

Source: Internet
Author: User

NFS

NFS, network File system. A system shares directories and files with others on the network. By using NFS, users and programs can access local

file access to files on the system.
Span style= "margin:0px; padding:0px; max-width:100%; Color:rgb (0, 0, 0); font-size:14px; " >
advantages: Save disk space
Composition: one server and one or more clients

1. Install, open

[[email protected] ~]# Systemctl start NFS

[[email protected] ~]# Systemctl start NFS Open service

Add a Firewall Policy

List Firewall status

2. Shared directory

[Email protected] ~]# mkdir/public/nfs-p # #建立共享目录

[Email protected] ~]# mkdir/public/nfs/file # #建立共享文件

[Email protected] ~]# vim/etc/exports

[Email protected] ~]# EXPORTFS-RV

Exporting *:/public/nfs

Exports content

Test

Client

Mount

3.autofs (Auto Mount tool)

Automatically mounts successfully when there is a need for direct access to/net

Install, open (client)

[Email protected] ~]# yum install autofs.x86_64-y

[Email protected] ~]# systemctl start AutoFS

View the root directory of AutoFS

Auto-mount to/net

[Email protected] nfs]# vim/etc/auto.master

Permanent Mount

[Email protected] nfs]# Vim/etc/auto.nfs

[Email protected] nfs]# systemctl restart Autofs.service

4. Some configuration of the shared directory

To shared directory permissions

Server (117 host) Exports/public/nfs * (SYNC,RW) # #共享给所有人可读可写

[Email protected] ~]# Vim/etc/exports

[Email protected] ~]# EXPORTFS-RV # #将刚编辑内容刷新并加载

Exporting *:/public/nfs

Test (in Test host)

Server (117 host) Exports/public/nfs 172.25.254.0/24 (sync) # #共享给172.25.254.0/24 Network Segment Read-only

[Email protected] ~]# vim/etc/exports

[Email protected] ~]# EXPORTFS-RV

Exporting *:/public/nfs

Test (in Test host)

Server (117 host) Exports/public/nfs * (SYNC,NO_ROOT_SQUASH,RW) # #共享给所有人, when the customer segment uses root mount does not convert user identity

[Email protected] ~]# vim/etc/exports

[Email protected] ~]# EXPORTFS-RV

Exporting *:/public/nfs

Test (in Test host)

Server (117 host) Exports/public/nfs * (sync,rw,anonuid=1001,anongid=1001) # #共享给uid =1001,gid=1001 users can read and write

[Email protected] ~]# vim/etc/exports

[Email protected] ~]# EXPORTFS-RV

Exporting *:/public/nfs

Test (in Test host)


Linux--nfs Network file sharing

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.