Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux configures NFS to realize file sharing

Shulou Source: shulou.com Published: 2022-06-02 05:21:30 11月13日 Update

NFS server: 182.207.129.74

NFS clients: 182.207.129.75 and 182.207.129.186

1. Check the installation of the installation package

# rpm-Q nfs-utils rpcbind

Note: redhat 5.x check portmap,redhat 6.x check rpcbind

two。 Configure the / etc/exports file on the NFS server

Vi / etc/exports

Then enter / home/cams/file 182.207.129.* (rw,sync,no_root_squash,no_all_squash)

Save exit

3. Start the rpcbind service

# service rpcbind start or service rpcbind restart

4. Start the nfs service

# service nfs start or service nfs restart

5. Query the sharing status of NFS on the NFS server

# showmount-e

6. Modify the properties and user permissions of the file mounted on the NFS server

# chown-R cams:cams / home/cams/

# chmod-R 755 / home/cams/

At the same time, it is necessary to ensure that the uid and gid of each server user are the same. Here, because the user already exists, modify the uid and gid.

# usermod-u 500 cams

# groupmod-g 500 cams

7. Query the sharing status of NFS in the NFS client

# showmount-e NFS server IP

8. Mount the shared directory in the NFS server on the NFS client

# mount NFS server IP: shared directory local mount point directory

# mkdir-p / home/cams/file

# mount 182.207.129.74:/home/cams/file / home/cams/file

# mount | grep nfs

Problem solving:

1. After mounting, both users and user groups are nobody

Modify the Domain entry in the nfs server and the client / etc/idmapd.conf file to make the configuration consistent. (if the server is not configured with a domain name, configure the domain name first, and then restart the server)

Tags: Service server user configuration client client file directory check consistency domain name status query at the same time attributes situation permissions user groups questions guarantee Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Linux vpn Shulou Technology Shulou Tech Info