Linux mount NFS with specific user

Gabor picture Gabor · Oct 12, 2014 · Viewed 29.3k times · Source

I was searching hours on the Internet, but for this specific problem I could not find any solution.

1: I have a Xubuntu Linux on my PC. I use it in average way: browse the Internet, watch videos, etc. And also it gives home for my PHPStorm app but no the project files. This is the HOST. It has a host-only network: 192.168.56.1

2: I have a VirtualBox Debian Linux (no GUI) system. This meant to be represent a development version of my real webserver. It has all the project files. This VM is on an external drive, so I can take it everywhere (e.g.: to the office). 192.168.56.101. This is the GUEST.

3: on the HOST I use dnsmasq to force every *.dev domain to be redirected to the GUEST. So I can test my projects easily.

4: on the GUEST I exported the /var/www folder in the /etc/exports:

/var/www 192.168.56.1(rw,sync,no_root_squash,no_subtree_check)

The problem: I want to use the PHPStorm on the HOST to edit the files on the GUEST "locally". But I cannot mount the GUEST's /var/www folder into the HOST's /home/gabor/Projects folder with full permissions. I tried to use the following:

$> sudo mount 192.168.56.101:/var/www /home/gabor/Projects

This looks okay for the first time, but the folder is mounted with nobody:nogoup and I have no permissions to edit.

I want the /home/gabor/Projects has the owner gabor:gabor and everything I create in this folder must has the owner www-data:www-data on the Debian side. But for NFS mounting I cannot specify the user.

$> sudo mount -o umask=0022,gid=1000,uid=1000 192.168.56.101:/var/www /home/gabor/Projects
mount.nfs: an incorrect mount option was specified

I also failed to mount --bind the /var/www with different user (should be nobody:nogroup) on the Debian, so that I could export that one...

How can I solve this problem? Please help me. Thank you.

Answer

Clown Man picture Clown Man · Apr 17, 2017

NFS v2 and v3 do not support uid/gid.

on Ubuntu man nfs