2

I have a Windows Server 2019 machine and a CentOS 8 machine on the same network. The CentOS server is hosting a webapp that uses files from the Windows machine.

To read these files, I had set up a Samba share on the Windows side and mounted it on the CentOS side via mount -t cifs //myserver/share /media/windows.

This worked, but I noticed some issues. Sometimes when trying to access files from this Samba share, it would just sit there. Unmounting and remounting didn't seem to help as the problem would just happen again.

I decided to try using NFS instead of Samba to share files between Windows 2019 and CentOS. After setting up the same folder, but instead as an NFS share, and using mount -t nfs myserver:/share /media/windows I was able to access the files that would make Samba hang.

The issue I am having is that when I make a new file in the NFS share from the CentOS side, the permissions are wrong on the Windows side and users on the Windows server cannot access the files.

I looked into this and tried to set up NFS user mapping, but I don't think I did it right.

Using PowerShell, I ran:

Install-NfsMappingStore -InstanceName "NFSMappingStore" -LdapPort 10389

and saw:

Successfully created ADLDS instance named NFSMappingStore on server MYSERVER, the instance is running on port 10389 and the partition is CN=nfs,DC=nfs.

I then ran:

Set-NfsMappingStore -EnableLdapLookup $true -LdapNamingContext "CN=nfs,DC=nfs"
    -LdapServer localhost:10389

Seeing as that worked, I then tried to add a user:

New-NfsMappedIdentity -MappingStore LDAP -Server localhost:10389
    -UserIdentifier 980 -GroupIdentifier 1001
    -UserName CentOsUser -PrimaryGroup "Domain Users"

This seemed to work correctly, so then back on the CentOS side, I mounted the NFS share as the CentOsUser user via:

sudo -u CentOsUser -g CentOsGroup mount -t nfs myserver:/share /media/windows

This worked, and I was able to create and write a file. But on the Windows side, I see that the (newly created) file's owner is actually S-1-5-88-1-980 instead of CentOsUser.

I also see S-1-5-88-2-1001 as well as S-1-5-88-3-420 and S-1-5-88-4.

Why is it showing S-1-5-88-1-980? I thought I mapped 980 to the CentOsUser user? I also thought I mapped 1001 to the Domain Users group, so why is it showing S-1-5-88-2-1001?

7
  • 1
    Resolve-NfsMappedIdentity -AccountName "CentOsUser" -AccountType "User" what does it tell you?
    – AndroidX
    Jun 23 at 13:29
  • @AndroidX "Resolve-NfsMappedIdentity : Failed to resolve identity mapping for user windows account CentOsUser. Verify if mapping store is configured on the server." :-(
    – gen_Eric
    Jun 23 at 16:00
  • How can I "Verify if mapping store is configured on the server?" I thought I had that set up...
    – gen_Eric
    Jun 23 at 16:01
  • Test-NfsMappingStore and if it exists you should be able to see its config with Get-NfsMappingStore
    – AndroidX
    Jun 23 at 16:50
  • @AndroidX Test-NfsMappingStore shows nothing.
    – gen_Eric
    Jun 23 at 17:11

2 Answers 2

0

I had the same issue and was struggling with it since a log time...

  • Now I intigrated Linux server with AD.
  • Managing all files and directory level permissions from Windows
  • the application user accessing files from windows NFS share is an AD authenticated user..

Above procedure still working for me.

1
  • How do I add the Linux server to an Active Directory? Will that affect anything else on the Linux server (it's also a web host)?
    – gen_Eric
    2 days ago
0

The best and easiest solution I found is https://github.com/billziss-gh/sshfs-win, connected servers shows up as a fully functioning network drives

Edit: Mounting a NTFS Share on Linux

mkdir /mnt/win1
mount -t cifs //10.10.1.100/share -o username=myUser,password=myPassword /mnt/win1
New contributor
Ace is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
4
  • Is this just for mapping SSH drives on Windows? That's pretty useful, but not quite what I needed. I needed to mount the other direction. Mount a folder from Windows on Linux.
    – gen_Eric
    2 days ago
  • Sorry, I misunderstood, you need to mount with ntfs: linuxconfig.org/…
    – Ace
    2 days ago
  • I need to mount a folder from Windows on Linux over the network. I was using CIFS/Samba but I was having issues. So, I tried NFS but was having different issues. I'm not a Windows Server guy, I'm more of a Linux guy.
    – gen_Eric
    2 days ago
  • @gen_Eric I'll edit my comment with some extra information.
    – Ace
    2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.