Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to share files by installing nfs in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces how to share files through the installation of nfs in Linux. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Introduction to nfs

Nfs network file system is often used to share audio, video, pictures and other static resources. Put the resources that need to be shared into the shared directory in NFS and access them by mounting the server.

Server installation: yum install-y nfs-utils rpcbind

Or

Yum install-y nfs-utilsyum install-y rpcbind client installation: yum install-y nfs-utils

Set Boot self-boot

Systemctl enable nfssystemctl enable rpcbind server configuration: 1. Create a shared directory mkdir-p / data/nfs-share2. After installing the nfs service, the configuration file exports is generated automatically. If not, create a / etc/exportscat / etc/exports3 on your own. Edit the shared configuration file vi / etc/exports/data/nfs-share * (rw,sync,no_root_squash) # / home/nfs * (rw,sync,no_root_squash) # / data/nfs-share *

The first column: the directory to be shared, that is, the file system you want to share to the network

Second column: hosts with access to host 192.168.152.13 specified IP address hosts with specified domain name 192.168.1.0 nfsclient.test.com 24 all hosts in the specified network segment * .test.com all hosts under the specified domain * all hosts

The third column: shared parameters the following are some common parameters shared by NFS:

Ro read-only access rw read-write access sync all data on request write sharing async NFS can request secure NFS to send insecure NFS over more than 1024 ports through secure TCP/IP ports below 1024 before writing data Send wdelay if multiple users want to write to the NFS directory Then write as a group (default) no_wdelay if multiple users want to write to the NFS directory, write immediately, and this setting is not required when using async. Hide does not share its subdirectory no_hide shared NFS directory in the NFS shared directory subtree_check if you share a subdirectory such as / usr/bin, force NFS to check the permissions of the parent directory (default) no_subtree_check and the above relative UID and GID mapping anonymous user anonymous for all_squash shared files without checking parent directory permissions, which is suitable for public directories. No_all_squash retains all requests from UID and GID (default) root_squash root users of shared files are mapped to the same permissions as anonymous users (default) no_root_squas root users have full administrative access to the root directory anonuid=xxx

Specify the UID of anonymous users in the NFS server / etc/passwd file, for example, edit / etc/exports as:

/ tmp * (rw,no_root_squash) / home/public 192.168.0.* (rw) * (ro) / home/test 192.168.0.100 (rw) / home/linux * .the9.com (rw,all_squash,anonuid=40,anongid=40) 4. Start nfsservice rpcbind start# prompt: Redirecting to / bin/systemctl start rpcbind.serviceservice nfs start# prompt: Redirecting to / bin/systemctl start nfs.service5. View the mount showmount-e 127.0.0.1 return content # Export list for 127.0.0.1 data/nfs-share # / data/nfs-share * client configuration: 1. Create the directory # / kubernetes mounted locally, mkdir-p / kubernetes2. Mount mount [server ip]: / data/nfs-share / kubernetes# such as mount 10.1.1.99:/home/nfs / kubernetes other

Configuration takes effect

# modify the shared configuration file to execute exportfs-r about how to share files in Linux by installing nfs. I hope the above can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report