In this tutorial, I will show you how to mount a NFS share on Windows 7 with Client for NFS without using neither Active Directory server nor SUA (Subsystem for UNIX-based Application).
Important: Client for NFS feature is only available on Windows 7 Ultimate Edition and Enterprise Edition. Thanks Eugene for this notice.
Important: Client for NFS feature is only available on Windows 7 Ultimate Edition and Enterprise Edition. Thanks Eugene for this notice.
The Client for NFS is included in the Windows 7, however, it is turned off by default. You can turn it on by access Control Panel → Programs → Programs and Features → Turn Windows features on or off.
Now, you can mount any NFS share on your network. However, if you try to open the mounted drive, you are most probable to receive an "Access is denied" notification. The reason is that Windows and UNIX use different mechanisms for user identification, authentication, and resource access control.
The mechanism of identifying an user on the Windows-based system is different from the Unix-based system, which uses User Identification (UID) and Group Identification (GID). Therefore, to access resources on an Unix-based system from a Windows-based system and vice versa, we have to map user information between Windows-based system and Unix-based system.
The most popular solutions are using an Active Directory for mapping user identification or using SUA. However, that is too complicated for a small environment, such as home or small office. For example, in my case, I have two Ubuntu boxes, one Windows box in the office, and one Windows box in my dormitory room. NFS server is running on one of my Ubuntu boxes.
By googling, I have found an un-documented trick to set the "default" anonymous UID and GID for Client for NFS to access a NFS share. Now, you can do it as follows:
- Open the Run box by pressing Windows + R.
- Start Registry Editor by running command regedit. Remember to click the Yes button on the User Account Control window.
- Locate HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default.
- Add two DWORD values: AnonymousUid and AnonymousGid.
- Set theses values to the UID and GID on the Ubuntu box. In the most popular cases, they are 1000 and 1000 in decimal base. Actually, it should be the UID and GID of the owner of the shared directory on the Ubuntu system.
- Restart your Client for NFS service or restart your computer.
Now, you can access Ubuntu box's NFS share from your Windows box.
Example
On the Ubuntu, I want to share the home directory of the user cuongnv /home/cuongnv. The owner UID is cuongnv (1000), and the owner GID is also cuongnv (1000). I assume that you know how to install NFS service on the Ubuntu (actually, you only need to install two package: portmap and nfs-kernel-server). My Ubuntu box's IP is 192.168.0.10, and I want to share above directory to all the computers in my network 192.168.0.0/24.
Now, on the Ubuntu box, you add the following line to the file /etc/exports:
/home/cuongnv 192.168.0.0/24(rw,sync,no_subtree_check)
Then, you need to run command exports -ra. Final, restart portmap service and nfs-kernel-server service.
On the Windows 7 box:
- Open Computer (or press Windows + E).
- Click the Map netwok drive button on the toolbar.
- Enter 192.168.0.10:/home/cuongnv on the Folder text box.
- Click Finish.
Done!