3

I have a Raspberry Pi with Raspberry Pi OS (ex Raspbian).

I wanted to share my home folder (/home/pi) with NFS. I'd like to access it also from my Windows 10 PC, reading and writing files as I was the "pi" user.

I launched the following commands:

$ sudo apt-get install nfs-kernel-server
$ id pi
uid=1000(pi) gid=1000(pi)
$ sudo nano /etc/exports

I added this line:

/home/pi        *(rw,all_squash,insecure,async,no_subtree_check,anonuid=1000,anongid=1000)

And then:

$ sudo exportfs -ra

After installing the Windows NFS Client component, I was able to connect my RPi home folder as a network drive. I can create files. However, I cannot edit files.

E.g.: I created a test file under windows. I create a test file under linux.

pi@sigipi:~ $ echo hello > test_pi.txt
pi@sigipi:~ $ ls -l test_*
-rw-r--r-- 1 pi pi 6 apr 19 23:29 test_pi.txt
-rwxr-xr-x 1 pi pi 0 apr 19 23:29 test_windows.txt

Both files are now read only from Windows. I cannot edit them. (but I can delete them).

Only way to edit them is launching this:

sudo chmod -R a+rw test*

What am I missing?

1

1 Answer 1

1

I tried a few more things and it seems, that my issue has been resolved. I changed the UID & GID in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default to my default user of my linux system (id <user>). I also had to set these IDs in /etc/exports.

Now I can remove the write-protection / read-only from files. Folders are still marked as protected, but I can delete/edit/move them.

There is a great blog-post that is very recent & in-depth: https://stealthbits.com/blog/mounting-nfs-exports-unix-server/

1
  • To be more specific, you need to create two DWORD values named AnonymousUid and AnonymousGid if they don't exist and then reboot.
    – Qin Heyang
    Commented Aug 22, 2023 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .