Update (Nov 9, 2011): As noted in the comments below, Windows Services for UNIX Version (SFU) is no longer supported on Windows 7 and 2008. For these versions, try installing Cygwin with the optional nfs-server component. If you’re using Windows 2008, you can use the Server for NFS that comes built-in instead – in this case, most of the steps below should apply.
A few days ago, I needed to share a large folder present on a Windows server to access it from my local Ubuntu workstation. I initially used Samba, but my build script refused to recognize paths present in that share.
The solution was to use an NFS share – but this required a special setup on Windows. Even after a lot of searching on Google, I couldn’t easily find a guide that talked about how to get started with an NFS server on Windows quickly. Most articles I came across were only detailing information on NFS security, or some obscure command line options for tweaking NFS options – which shouldn’t be required when all you want is a simple share within your local, protected network.
So, here’s what to need to do if you need an NFS server enabled on Windows quickly, and mount it on your Linux box:
1) Download Windows Services for UNIX from Microsoft’s Download Center. Here’s the direct download link.
2) Run setup.exe from the extracted directory.
3) Follow the prompts, until you reach the following screen:
Choose custom installation – since we’d like to only install the NFS server for sharing folders.
4) Choose the following three components to install:
(i) NFS -> Server for NFS
(ii) Authentication tools for NFS -> User Name Mapping
(iii) Authentication tools for NFS -> Server for NFS Authentication
Here’s a pictorial representation of the components you’ll need:
5) On the next screen, choose to change the behavior to case-sensitive, to provide full compatibility with UNIX programs
6) On the User Name Mapping screen, choose “Local User Name Mapping Server” and “Password and group files”:
7) Now, copy your passwd and group files from your UNIX/Linux distribution onto your Windows machine. For Ubuntu, these are located at /etc/passwd and /etc/group. Provide the paths to these files in the next screen:
8) Continue with the installation prompts until you finish.
9) Windows Services for UNIX should now be installed:
10) Open the Services for UNIX Administration shortcut, and click on User Name Mapping:
11) Click on “Show User Maps” and then click on the buttons for Listing Windows Users and Linux Users:
12) Choose “Administrator” (or the appropriate account you want to map the UNIX user to) in the Windows list, and your username in the Linux list. (In Ubuntu, UIDs for user accounts usually start from 1000)
13) Click “Add” to create a map. If you get the following warning, click “OK” to ignore it.
14) Click Apply at the top right corner.
15) Now, you’re ready to share folders! Just right click any folder you need to share, and share it from the NFS tab. You can click the Permissions button for more options, like allowing write access, which is disallowed by default.
16) Next, mount the share on your UNIX/Linux machine. I used the following command on Ubuntu:
$ sudo mount <windows-server-ip-address>:/<windows_share_name> <path_to_local_mount_point>
$ sudo mount 192.168.1.3:/SharedFolder ~/windows_share
If this guide helped you, please let us know in the comments below!