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.
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.
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.
nfsadmin client stop
. This will stop NFS client services on your system.UID
and GID
to 0
to work better. Start regedit
(Click search windows button, type regedit
) to enter registry editor.HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default
AnonymousGID
.AnonymousUID
.AnonymousGID
and AnonymousUID
, set the value as 0
and the base as Decimal respectively.nfsadmin client start
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.
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.
grep nfsnobody /etc/fstab
rw,sync,no_root_squash,all_squash,anonuid=65534,anongid=65534
/etc/exports:
/test_nfs_share *(rw,sync,no_root_squash,all_squash,anonuid=65534,anongid=65534)
pcs resource update NFS_test_Share options=rw,sync,no_root_squash,all_squash,anonuid=65534,anongid=6553
chown nfsnobody:nfsnobody /test_nfs_share
chmod 770 /test_nfs_share
pcs resource refresh NFS_test_Share
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:
mount -o anon \\<nfs server>\<exported share path> <drive letter>:
Your share is now ready and you can write contents to it.
Disclaimer:
The views expressed and the content shared in all published articles on this website are solely those of the respective authors, and they do not necessarily reflect the views of the author’s employer or the techbeatly platform. We strive to ensure the accuracy and validity of the content published on our website. However, we cannot guarantee the absolute correctness or completeness of the information provided. It is the responsibility of the readers and users of this website to verify the accuracy and appropriateness of any information or opinions expressed within the articles. If you come across any content that you believe to be incorrect or invalid, please contact us immediately so that we can address the issue promptly.
Shibin John
Project Technical Lead
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Leave a Reply