Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Need some help here with NFS. Here's what I have (all servers running CentOS 5.6 with SELinux):

172.17.20.1 - Primary server with static IP. Varnish redirects requests to the web servers.
172.17.20.2 - Web server 1
172.17.20.3 - Web server 2

The application residing on the web servers is running Drupal and I need both of them to share the same files directory. I have created a folder in 172.17.20.1 called /var/nfs with root user. Here is my /etc/exports content:

/var/nfs    172.17.20.2(rw,sync,no_root_squash) 172.17.20.3(rw,sync,no_root_squash)

On both the web servers (172.17.20.2/3), I have it mounted like below:

[root@web2 ~]# mount
...
172.17.20.1:/var/nfs on /mnt/nfs/var/nfs type nfs (rw,sync,hard,intr,addr=172.17.20.1)

On all the servers, I've added the user apache to the root group to get the desired write access:

[root@main ~]# cat /etc/group
root:x:0:root,apache
....
....
apache:x:48:

[root@web1 ~]# cat /etc/group
root:x:0:root,apache
....
....
apache:x:48:

Folder permission on main:

drwxrwxr-x  4 root root 4096 Mar 11 15:49 nfs

Folder permission on web servers:

drwxrwxrwx   3 apache apache  4096 Feb 18 13:51 mnt

Despite all this, when I try to write files into the /mnt/nfs/var/nfs folder from Drupal/PHP, it cannot write to it. I even tried with a simple PHP upload script but it doesn't work, so the problem is not with Drupal.

Any help you guys can do is much appreciated. I've spent hours and hours with it, without any success :(

Thanks in advance.

share|improve this question

1 Answer 1

I've added the user apache to the root group to get the desired write access

But you've not shown us what the permissions are on the files / directories. (and BTW this is not a good idea from a security stand point - similar for no_root_squash).

Why sync?

share|improve this answer
    
I've updated the question with the permissions. I know its not a good idea, but I've tried everything desperately! Syncing is needed because files will be uploaded in both web nodes - unless synced to a central place, the servers will not have each others file. –  phpfour Mar 26 '12 at 13:36
    
This does look like a simple permissions issue - unless you've got syncronised uids across server and client then the simplest solution will be to make the directory on the server rwx for other. –  symcbean Mar 26 '12 at 15:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.