Nfs – properly setting up shared images nfs mount for apache

apache-2.2filesystemsnfs

I am trying to figure out the best way to set up an NFS server so that my Apache servers which have a shared images mount can create images there.

Here is the current configuration on the nfs server exports (just the export options)

(sync,no_subtree_check,all_squash,rw) 

As a result, all of the files are created as and owned by the user nfsnobody.

I had to chmod 777 the entire directory to make apache be able to write to this directory, something I was not fond of, but that's my temporary workaround, which I am hoping you can help me with.

The other issue is that there is no apache user on the nfs server, so when apache tries to create files, it shows the uid as 57843 for example instead of the username.

Which brings me to the client side configuration:

Nfs mounts on the client are mounted as:

/someexport /somemount  nfs defaults,acl    0 0

There are a lot of problems with this configuration including the 777 permissions, and the uid mismatch.

What is a better configuration for this situation I might use?

Also, should apache be a member of the nfsnobody group?

Best Answer

If you control the NFS server add an apache user with the same UID/GID. Then the files can be owned by the appropriate user.