How to allow writing to a mounted NFS partition
- by Cerin
How do you allow a specific user permission to write to an NFS partition?
I've mounted an NFS share on my localhost (a Fedora install), and I can read and write as root, but I'm unable to write as the apache user, even though all the files and directories in the share on my localhost and remote host are owned by apache.
For example, I've mounted it via this line in my /etc/fstab:
remotehost:/data/media /data/media nfs _netdev,soft,intr,rw,bg 0 0
And both locations are owned by apache:
[root@remotehost ~]# ls -la /data
total 24
drwxr-xr-x. 6 root root 4096 Jan 6 2011 .
dr-xr-xr-x. 28 root root 4096 Oct 31 2011 ..
drwxr-xr-x 4 apache apache 4096 Jan 14 2011 media
[root@localhost ~]# ls -la /data
total 16
drwxr-xr-x 4 apache apache 4096 Dec 7 2011 .
dr-xr-xr-x. 27 root root 4096 Jun 11 15:51 ..
drwxrwxrwx 5 apache apache 4096 Jan 31 2011 media
However, when I try and write as the apache user, I get a "Permission denied" error.
[root@localhost ~]# sudo -u apache touch /data/media/test.txt'
touch: cannot touch `/data/media/test.txt': Permission denied
But of course it works fine as root. What am I doing wrong?