Sunday, 1 July 2018

Freenas: Mount NFS as an alternative to SMB

As Windows 10 no longer supports SMB v1 as used by FreeNAS 0.7.2, it was necessary to find an alternative.

NFS works in Windows 10. You can describe the NFS client as described here.

I found I needed the nolock option to be able to view files.

mount -o nolock -o anon \\<Server>\<mount> x:

e.g. mount -o nolock -o anon \\<Server>\mnt\Data x:

It was also necessary to set two registry keys on each client to set the user ID and Group ID. Restart the NFS client with nfsadmin client start | stop.

This article also describes how you can change the user ID so the share is mounted as a different user.

If you mount NFS shares from an elevated command prompt (Run as administrator), the mount will not show up in the explorer running with normal user privileges. The solution is to unmount the share and remount it, either from explorer or from an ordinary command prompt. Admin privileges are not required for NFS mounts.

To find a user's UID or GID in Unix, use the id command. To find a specific user's UID, at the Unix prompt, enter:
 id -u username
Replace username with the appropriate user's username. To find a user's GID, at the Unix prompt, enter:
 id -g username
If you wish to find out all the groups a user belongs to, instead enter:
 id -G username
If you wish to see the UID and all groups associated with a user, enter id without any options, as follows:
 id username

Setting up on a machine for the first time
It is important to set the underlying Unix account that will be used by the anonymous account and nfs.

Without registry settings:

Test1: Folder created by FreeNas (root):  root/wheel - inaccessible by explorer
Test2: Folder created by SSH (root): root/wheel   - inaccessible by explorer
Test3: Folder created by X: drive before resgistry settings applied:  4294967294/wheel - accessible by explorer

By setting the registry settings:
AnonymousUid (DWORD32) : 1001 (decimal) - For <username>
AnonymousGid (DWORD32) : 0 (decimal)

and restarting nfsadmin client stop / start 
then:

Test4: Folder created by X: drive:  <username>/wheel - accessible by explorer


SSH to FreenNAS
ssh -oHostKeyAlgorithms=+ssh-dss <username>@freenas

No comments:

Post a Comment