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 configure nfs for Linux server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the Linux server how to configure nfs, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Configure nfs

The main configuration file for the NFS service is / etc/exports. / etc/exports file content format:

Client (options: access rights, user mapping, other)

1. Output directory

The output directory refers to the file system defined in the NFS system that is shared to the client.

2. Client

The client defines the IP address or network segment or domain name that can access the NFS shared directory in the network. It is a common way to specify.

1) the host with the specified ip address: 192.168.100.1

2) specify a subnet: 192.168.100.0amp 24 can also be written as: 192.168.100.0and255.255.255.0

3) specify the host of the domain name: david.bsmart.cn

4) all hosts in the specified domain: * .bsmart.cn

5) all hosts: *

3. Options

Option is used to set the access rights of the output directory, user mapping, and so on.

1) there are three main types of options for NFS:

Set the output directory to read-only: ro

Set output directory read / write: rw

2) user mapping options

All_squash: maps all ordinary users and groups that are accessed remotely to anonymous users or user groups (nfsnobody)

No_all_squash: inverted from all_squash (default)

Root_squash: map root users and their groups to anonymous users or user groups (default)

No_root_squash: inverted from rootsquash

Anonuid=xxx: maps all users accessed remotely to anonymous users and specifies the user as a local user (UID=xxx)

Anongid=xxx: maps all user groups accessed remotely to an anonymous user group account and specifies the anonymous user group account as a local user group account (GID=xxx)

3) other options

Secure: restricts clients to connect to nfs servers only from tcp/ip ports less than 1024 (default setting)

Insecure: allows clients to connect to the server from a tcp/ip port greater than 1024

Sync: write data synchronously to memory buffers and disks, which is inefficient, but can ensure data consistency.

Async: save the data in a memory buffer before writing to disk if necessary

Wdelay: check if there are related writes, and if so, perform them together to improve efficiency (default setting)

No_wdelay: if there is a write operation, it should be performed immediately. It should be used with sync.

Subtree: if the output directory is a subdirectory, the nfs server will check the permissions of its parent directory (default)

No_subtree: even if the output directory is a subdirectory, the nfs server does not check the permissions of its parent directory, which improves efficiency

4. Examples

1) Edit configuration file

[root@localhost ~] # gedit / etc/exports / / configuration file, shared directory, read-only

/ wj * (ro,all_squash,sync)

2) restart the service

[root@localhost ~] # service nfs restart / / restart the service

Close the NFS daemon: [OK]

Close NFS mountd: [OK]

Close NFS quotas: [OK]

Shut down the NFS service: [OK]

Shutting down RPC idmapd: [OK]

Start the NFS service: exportfs: No options for / wj *: suggest * (sync) to avoid warning

Exportfs: No host name given with / wj (ro,no_all_squash,sync), suggest * (ro,no_all_squash,sync) to avoid warning

Exportfs: duplicated export entries:

Exportfs: *: / wj

Exportfs: *: / wj

[OK]

Turn off NFS quota: [OK]

Start NFS mountd: [OK]

Start the NFS daemon: [OK]

Starting RPC idmapd: [OK]

[root@localhost ~] #

3) client mount

[root@localhost ~] # mount 192.168.1.8:/wj / media/test/ Mount the shared directory wj on the server

Thank you for reading this article carefully. I hope the article "how to configure nfs on Linux Server" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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

Servers

Wechat

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

12
Report