Site icon techbeatly

Mounting NFS share from Linux to Windows server

Image : https://businessfirstfamily.com
Servers used: RHEL 7.6 as NFS server & Windows 2016 as NFS Client

In this scenario, we have NFS server up and running with shares mounted across different Linux clients. The requirement here is, one of the share or a new share need to be mounted in Windows server with read/write access to AD user.

Installing NFS Client on Windows Server

Windows has built-in feature available to support NFS. However often this will not be enabled by default. We need to install this “optional feature” first.

Login to the client server. Ensure that you have admin rights to that server in order to do this.

Display Name                                            Name                       Install State
 ------------                                            ----                       -------------
 [ ] Client for NFS                                      NFS-Client                     Available
PS C:\Users\Admin_test> Install-WindowsFeature -Name NFS-Client

Success Restart Needed Exit Code      Feature Result
 ------- -------------- ---------      --------------
 True    No             Success        {Client for NFS}

Now that you have NFS Client features enabled. This now need to configure.

Configure NFS Client on Windows server

By default, NFS Client in windows uses Anonymous UID and GID value with -2. Often this works for just mounting, but give troubles while you try to insert / update contents.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default
nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i

Now that you have configured your NFS Client. We now need to export the directory in Linux to share.

Exporting directory in Linux with correct parameters

If Linux is using AD authentication, the NFS export features may not be work well with AD. So, it is better to use anonymous user with correct permission settings. This way we can avoid security risk by giving full read-write access to all of them ( user, group and others ). People tend to give permission level 777 to folders for easy fix. However, this invites more security risk.

NFS server in Linux always have a user called nfsnobody. When we mount a share in other places with anonymous option, this nfsnobody can play well with that. However we need to set its UID and GID correctly with the share we exports.

That’s all. We are now ready to mount the share on a windows server where it allowed to mount. You can do this using either of 2 ways as given below:

Your share is now ready and you can write contents to it.

Exit mobile version