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

Deployment of NFS

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

NFS: network file system allows a system to share directories and files with others over the network. By using NFS, users and programs can access files on remote systems as if they were local files.

Here are the most obvious benefits of NFS:

Local workstations use less disk space because common data can be stored on a single machine and accessed over the network.

Users do not have to have a home directory on every machine on the network. The Home directory can be hosted on an NFS server and made available anywhere on the network.

Storage devices such as floppy drives, CDROMs, and Zip can be used by other machines on the network. This can reduce the number of removable media devices on the entire network.

NFSv3

Version 3 (RFC 1813, June 1995) adds the following features:

Support 64 bit file size and offset (i.e. break through the 2GB file size limit);

Support asynchronous write operations on the server side to improve write performance;

Add additional file attributes to many response messages to avoid retrieving them when they are used;

Add READDIRPLUS call to get file descriptors and file attributes when traversing directories;

NFSv4

NFSv4 (RFC 3010, December 2000; revised in RFC 3530, April 2003), which draws on the characteristics of AFS(Andrew File System) and SMB/CIFS(Server Message Block), mainly makes the following improvements: performance improvement, mandatory security policy, introduction of stateful protocol [5].

NFSv4.1 (RFC 5661, January 2010) is designed to provide protocol support for parallel access to scale-out cluster services (pNFS extensions).

Description of some options for NFS configuration

rw: reading and writing;

ro: read-only;

sync: synchronous mode, data in memory is written to disk from time to time;

async: asynchronous, write data in memory to disk regularly;

no_root_squash: With this option, root has the same privileged control over shared directories as it does over native directories. Not safe, not recommended;

root_squash: Corresponding to the above options, root user has low permissions on shared directories, only normal user permissions, that is, root is restricted;

all_squash: No matter who the user is using NFS, his identity will be restricted to a specified ordinary user identity;

anonuid/anongid: Used with root_squash and all_squash to specify the uid and gid of a qualified user using NFS, provided that the uid and gid are present in/etc/passwd on the local computer.

Configuration:

Server(192.168.1.30):

##Define NFS directories, allow access to network segments, permissions rw(read/write), ro(read only), sync synchronization. anonuid=500,anongid=500 Restriction id:500 This user is the owner when creating the file, and 500 is the client user. no_root_squash does not restrict root, and the files it creates belong to root.

1. vim /etc/exports ##Configuration can choose one of the following, or you can do multiple shared directories at the same time

/mnt 192.168.1.30/24(rw,sync,all_squash,anonuid=500,anongid=500)

#It is divided into three parts. The first part is the directory to be shared locally. The second part is the host to be allowed to access (it can be an IP or an IP segment). The third part is the one in parentheses, for some permission options.

yum install -y nfs-utils rpcbind## rpcbind is used for data communication

##Start the service

3、/etc/init.d/rpcbind start ;/etc/init.d/nfs start

Reload configuration file: exportfs -arv

## NFS Directory Authorization

4、chmod 777 /mnt

Client(192.168.1.31):

1、yum install -y nfs-utils

##View NFS shared directories and users/segments

2、showmount -e 192.168.1.30

3. mount -t nfs -onolock,nfsvers=3 192.168.1.30:/mnt file for a long time without response, you can add-onolock option. Centos6 may not be compatible with nfs services and is error-prone, so add the option nfsvers=3, or version 4 if nfs is not specified.

4. df -h can view the mounted directory, but/opt cannot be written before authorization, so the Server needs to authorize the shared directory/mnt (chmod 777 /mnt), and the default user nfsnobody when creating files. If the Server sets up users, the files are created to belong to the set users.

Testing:

Clnt_create: RPC: Program not registered

Workaround: stop rpcbind on the server first,

/etc/init.d/rpcbind stop

Then stop at nfs

/etc/init.d/nfs stop

Finally restart rpcbind and nfs, be sure to start and stop in sequence

/etc/init.d/rpcbind start

/etc/init.d/nfs start

After doing this action, the visit is successful

After successful mounting, touch the new file ls -l and find that the user belongs to the main mapping is not normal. Solution:

Mount again.

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

Network Security

Wechat

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

12
Report