Excel files on a Samba network drive don't open

Viewed 507

I have a Microsoft Server 2019 Standard with MS Office installed. I also have a Linux server that shares each user's ~/windows/ directory through Samba with their Windows account when they're logged in. The rights to the folder are always set to 777 and are owned by the user and the group users, to which the user belongs.

However, when they open a .xslx file located in the said directory, the following error appears:

"Sorry, we couldn't find \AppData\Local\Microsoft\INetCache\Content.MSO\111191F2.xlsx. It is possible it was moved, renamed or deleted?"

Opening up the location reveals that the file is indeed there, which hints at some problems with privileges. Opening the file on the network drive as Administrator works, which again hints at problems with privileges, but I haven't been able to debug this.

I did no Active Directory setup, the disk is connected using net use (with a user's password) in the following way:

net use S: \\<address>\<user> <password>

As for the Samba config, here is the relevant part:

[homes]
  browseable = no
  path = /home/%S/windows
  read only = no
  valid users = %S

Saving the file locally and opening it after works without any problems.

Editing a simple text file in Notepad works without any issues. Samba logs the following (it logs much more, but this should hopefully be the relevant part):

[2021/11/01 11:27:49.692907,  3] ../source3/smbd/dir.c:1225(smbd_dirptr_get_entry)
  smbd_dirptr_get_entry mask=[*] found test.txt fname=test.txt (test.txt)
[2021/11/01 11:27:49.692966,  3] ../source3/smbd/smb2_server.c:3195(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[5] status[STATUS_NO_MORE_FILES] || at ../source3/smbd/smb2_query_directory.c:158
[2021/11/01 11:27:49.694329,  2] ../source3/smbd/open.c:1447(open_file)
  tom opened file test.txt read=Yes write=No (numopen=4)
[2021/11/01 11:27:49.694999,  3] ../source3/smbd/smb2_server.c:3195(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_getinfo.c:159
[2021/11/01 11:27:49.696187,  3] ../source3/smbd/smb2_read.c:421(smb2_read_complete)
  smbd_smb2_read: fnum 2027028822, file test.txt, length=24 offset=0 read=24

Running accesschk.exe -ld S: (by the problem user) yields the following:

S:\
  DESCRIPTOR FLAGS:
      [SE_DACL_PRESENT]
      [SE_DACL_PROTECTED]
      [SE_SELF_RELATIVE]
  OWNER: S-1-5-21-2603346316-3644132649-3033319823-1025
  [0] ACCESS_ALLOWED_ACE_TYPE: S-1-5-21-2603346316-3644132649-3033319823-1025
          [OBJECT_INHERIT_ACE]
          [CONTAINER_INHERIT_ACE]
    FILE_ALL_ACCESS
  [1] ACCESS_ALLOWED_ACE_TYPE: S-1-22-2-1000
          [OBJECT_INHERIT_ACE]
          [CONTAINER_INHERIT_ACE]
    FILE_ALL_ACCESS
  [2] ACCESS_ALLOWED_ACE_TYPE: Everyone
          [OBJECT_INHERIT_ACE]
          [CONTAINER_INHERIT_ACE]
    FILE_ALL_ACCESS
  [3] ACCESS_ALLOWED_ACE_TYPE: S-1-22-2-1000
    FILE_ALL_ACCESS
  [4] ACCESS_ALLOWED_ACE_TYPE: S-1-5-21-2603346316-3644132649-3033319823-1025
    FILE_ALL_ACCESS
  [5] ACCESS_ALLOWED_ACE_TYPE: CREATOR OWNER
          [OBJECT_INHERIT_ACE]
          [CONTAINER_INHERIT_ACE]
          [INHERIT_ONLY_ACE]
    FILE_ALL_ACCESS
  [6] ACCESS_ALLOWED_ACE_TYPE: CREATOR GROUP
          [OBJECT_INHERIT_ACE]
          [CONTAINER_INHERIT_ACE]
          [INHERIT_ONLY_ACE]
    FILE_ALL_ACCESS

Any help would be much appreciated!

2 Answers
Go to File -> Options -> Trust Center -> click on Trust Center Settings -> Trusted Locations -> select "Allow Trusted Locations on my network(not recommended"

Then Click on "File Block Settings" under Trust Center,

Uncheck the following or others that pertain to your excel version.

"Excel 4 Workbooks”

"Excel 4 Worksheets”

"Excel 3 Worksheets”

"Excel 2 Worksheets”

"Excel 4 Macrosheets and Add-in files"

"Excel 3 Macrosheets and Add-in files"

"Excel 2 Macrosheets and Add-in files"

Click Ok.

Close all your excel files and try to open that excel file from the network share.

I just remembered that you are probably missing samba user map file, which maps windows user to *nix user.

In the [global] section you need to add

[global]
user map = /<path>/mapusers.txt

The details can be found at man pages.

In the text file mapusers.txt you need to have one line per mapping.

In your case it would be all windows users are mapped to one linux user or group:

linux_user = windows_user

or

@linux_group = @windows_group

Related