NFS mount and write failures

Source: Internet
Author: User

Recently in the architecture, the separation of a picture server, Image Server through NFS (Network File system) to two Web servers to provide picture storage, when editing the NFS configuration file (/etc/exports): Think of, allow access to the NFS shared directory scope with "*" Scope is too large, unsafe; and then I thought about defining a network of two Web servers to access the NFS service, and any other unauthorized mount access, the Special edit NFS configuration file (/etc/exports) reads as follows:

/data/bbs 192.168.0.% ( Rw,sync,no_root_squash,no_all_squash)

Save Exit! Start Services for NFS: Service Rpcbind start

Service NFS Start

An error occurred while mounting the client:

Mount.nfs:access denied by server while mounting 192.168.0.113:/data/bbs

/data/bbs 192.168.0.* (Rw,sync,no_root_squash,no_all_squash)

Save the Exit again! Restart Services for NFS: Service Rpcbind start

Service NFS Start

Mount the client again or the same error occurs:

Mount.nfs:access denied by server while mounting 192.168.0.113:/data/bbs

The server is also mounted on the local test, but also the same error, error ibid, at this time let the error toss a bit dizzy, the server local mount is not successful, is certainly the configuration file configuration is wrong, did not think of it.

For this mistake, looking for someone to consult, their own online check, there is said to be the authority problem, there is said to be NFS configuration file problems, look at the system log, no obvious error hints, then static heart to think about, before doing NFS, the definition of network segment is so defined, remember not very clear, is not the following, holding a try Attitude

/data/bbs 192.168.0.0/24 (Rw,sync,no_root_squash,no_all_squash)

Save the Exit again! Restart Services for NFS: Service Rpcbind start

Service NFS Start

Again on the client mount, miraculously successful, no error occurred.

At this time to open the forum, try to post, no problem, upload pictures automatically save, the hint picture can not be saved, depressed ...

It's another meal. Modify the NFS configuration file, no matter how to modify, no, or the same, upload pictures automatically saved, the hint picture cannot be saved. There is no way to find solutions online, a large pile, ask others also say bad. When I think of the previous NFS experiment was done according to the book, without any errors, succeeded, opened the book to see How to operate:

1. Add the same user on the NFS server and the client, and specify the user UID to be the same, and set the user not to log on to the system

Useradd-u 505 www-m-s/sbin/nologin (the user that is the UID number of the NFS server and the client is created respectively)

2. Create the same mount directory on the NFS server and on the client respectively

MKDIR/DATA/{BBS,BLOG,CMS}, the client's mount directory can be given to the host user, the user group, the server side does not change the NFS shared directory owner, user group

3. Give all users write access to the shared directory created on the NFS server

chmod a+w-r/data

4. Edit the NFS service configuration file (/etc/exports) on the NFS server as follows:

/data/bbs 192.168.0.0/24 (Rw,sync,no_root_squash)

Save Exit! Restart Services for NFS: Service Rpcbind start

Service NFS Start

5. Re-uninstall on the client, Mount, open the forum, post upload pictures, success, haha!

6. Set up auto-mount on the client:

echo "192.168.0.113:/data/bbs/data/bbs NFS default 0 0" >>/etc/fstab

This article is from the "Lanzhou Linux operation and Maintenance" blog, please be sure to keep this source http://linuxzkq.blog.51cto.com/9379412/1632064

NFS mount and write failures

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.