Thursday, May 15, 2008
Using NFS mounts under Windows
When one needs to access files on remote Linux workstation from a windows computer, there are two obvious ways in which this can be done: run Samba server on Linux or NFS client on Windows. While former approach is I guess by far more popular, here I will consider later one: sharing files via NFS client/server.
First, we need to install a NFS client. I don't know of any free one, and perhaps the best known and reliable commercial solution is DiskAccess from Javvin Technologies. Installation is straightforward.
Problems begin though when it turns out that in order to access NFS file system with DiskAccess one needs certain authentication configuration setup. This could be and is done in a corporate environments with NIS (formerly Yellow Page server).
However, when we only have two machines that need to talk to each other, this might be an overkill and a disaster to setup. This is perhaps why there is another option in aforementioned dialog, "PCNFSD Server". What is that?
As the name suggests, this is perhaps mini-daemon intended to facilitate communication between "PC" and NFS server. This sounds good, except that this utility is barely known even to Google, isn't in any Linux distribution, and as a matter of a fact "canonical" version from SUN is perhaps older than Linux itself.
Fortunately, one kind soul invested necessary effort to port this to Linux
- Get it here: http://ftp.linux.org.uk/pub/linux/Networking/attic/Other/pcnfsd/linux_pcnfsd2.tgz, untar and unzip into a new directory;
- Edit file common.h to uncomment "#define SHADOW_SUPPORT"
- Make other changes necessary to build successfully. On RHE4, I had to define "LIBS= -lcrypt" in Makefile.linux;
- make -f Makefile.linux
- Run linux/rpc.pcnfsd as root. No configuration is required.
Fast, simple, and keeps DiskAccess happy.
Of course, what remains to be done is to "export" a directory and "mount" it under Windows.
To export directory /ext/user on RHE4:
- Add line like this:
/ext/user 192.168.2.1/255.255.252.0(sync,rw)
to file /etc/exports (provided that this IP subnet is an accurate description of your local net, this will export directory in read-write mode to the local file system only. You can substitute '*' for IP range if security is not on the top of your priorities list); - Reset list of exported directories with /usr/sbin/exportfs -r or /usr/sbin/exportfs -a ;
- While this is supposed to be enough, you may need to restart NFS server with command like this: /etc/rc.d/init.d/nfs restart
To mount exported NFS directory under Windows,
- Once after DiskAccess installation, go to control panel, select DiskAccess item and enter your credentials, and set other options as you see fit;
- You can now mount with regular Windows UI or with command like this:
net use R: \\nfs_host\ext\user
You shouldn't be forced to use drive letter, but for some reason it didn't work for me without that.
Labels: linux, NFS, server, windows