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

What are the knowledge points of linux NFS?

2025-02-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "what are the knowledge points of linux NFS". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the knowledge points of linux NFS"?

Nfs is the abbreviation of network file system, that is, network file system. 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 others on the network. By using nfs, users and programs can access files on remote systems as if they were local files.

Nfs is based on rpc protocol, nfs itself only plays the role of sharing, and connecting and data transmission with client is the function of rpc protocol.

Nfs is mainly controlled by two daemon:

1.rpc.nfsd-it controls whether the client can connect to nfs server.

2. Rpc.mountdMurmuri-it is used to control whether the client has permission to operate on the file after connecting, mainly according to the setting of / etc/exports file.

Enabling nfs requires enabling portmap and nfs-utils

1.portmap is mainly used to control the port requested when the client connects.

2.nfs-utils is the execution file of rpc.nfsd and rpc.mountd

/ main configuration file for etc/exports nfs service

Administrative commands for / usr/sbin/exportfs nfs service

/ usr/sbin/showmount client view command

/ var/lib/nfs/xtab records the information of customers who have logged in

/ etc/exports file formatting

[shared directory] ip or host (parameter 1. Parameter 2) ip or host (parameter 3, parameter 4)

The main parameters are as follows

Rw: read and write

Ro: read-only

No_root_squash: if the client login is root, it has root permission after logging in to the shared directory

Identity is compressed to nfsnobody after root_squash:root login (by default)

All_squash: all users' identities are compressed to nfsnobody after login (default)

Anonuid: you can change this item if you don't want the user to log in and be compressed to nfsnobody.

Anongid: ditto (this is a group)

Sync: write data to hard disk synchronously

Async: data is stored in memory first

Analysis of permissions

1. When the client connects, check the ordinary user. If the no.1 explicitly sets the identity of the ordinary user to be compressed, then the identity of the client user is converted to the specified user. No.2, if there is a user with the same name on the nfs server, then the identity of the client login account is converted to the user of the same name on nfs server. If no.3 is not explicitly specified, there is no user of the same name. Then the user identity is compressed into nfsnobody at this time.

two。 When the client connects, check the root. If no.1 sets no_root_squash, the identity of the root user will be compressed to the root,no.2 on the nfs server. If all_squash, anonuid and anongid are set, the root identity will be compressed to the specified user, and if the no.3 is not explicitly specified, the root user will be compressed to nfsnobody,no.4. If both no_root_squash and all_squash users are specified, the user will be compressed to nfsnobody. If anonuid is set, anongid will be compressed to the specified users and groups

Start the service

Service portmap start or / etc/rc.d/init.d/portmap start

Service nfs start or / etc/rc.d/init.d/nfs start

Exportfs command usage

-a mount or uninstall all

-r re-read the information in / etc/exports and synchronously update / etc/exports, / var/lib/nfs/xtab

-u uninstall a single directory (used with-a to uninstall directories in all / etc/exports files)

-v output details on the screen

Showmount command usage

-a displays directory information that is already on the client connection

-e ip or hostname displays the directory shared by this ip address

Using netstat, we can see that many ports are opened by nfs service, of which nfs is opened by 2049 portmap, while others are opened by rpc

Using rpcinfo-p, you can find out what programs are provided by the ports opened by rpc.

The mount can be completed by using mount-t nfs ip (hostname): a shared directory mount point

Finally, pay attention to two points. Although ordinary users can access it through permission settings, only root can be mounted by default when mounting (ordinary users can execute sudo)

When nfs server shuts down, make sure that the nfs service is off and that no client is connected! You can view it through showmount-a, and end it with kill killall pkill, if any, (- 9 forced end)

At this point, I believe you have a deeper understanding of "what are the knowledge points of linux NFS?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report