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
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
I also see
S-1-5-88-2-1001 as well as
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