Excel reports files in read only mode after recovering from sleep

NethServer Version: 7.4.1708

Hello,

We have two shares where users keep some Excel files. If a computer enters in sleep mode while an Excel file is opened from the Samba share, when is waked up it says the Excel file is in read-only mode because is already opened by “user X”, where “user X” is the user of the computer. If I restart the Samba service everything is back to normal.
Do you know a way how can I prevent file locks in Samba?

Istvan

Which Excel version(s) do you use? I see basically two approaches: Change the Excel way to save (cached) files or change Samba way to lock files. I tend to the first choice.

I did some research and found:

https://social.technet.microsoft.com/Forums/lync/en-US/3e3c9aad-3164-452a-9832-9ea9a2477936/excel-2013-set-all-file-readonly-for-user-on-network-drive?forum=excel

I’ll try to reproduce your issue…

We have Excel 2016 with Windows 10.

I tried it now (Win 10 Client, Excel 2016, fully updated NS4 AD Server) with a guest share and it worked after wake up. Did you set some ACLs on the share or do you already use custom templates as regards samba?

You should also check if something went wrong during the boot.

Is the whole root filesystem mounted in read-only mode?
You can see it by executing the mount command.

What is a “fully updated NS4 AD Server” ?
The shares are guest enabled. There are no custom templates. Everything the default.

Restarting Samba unlocks the files.

1 Like

Nethserver Samba 4 Active Directory with all updates installed.

I can confirm this.

You can check the status of locked files with

smbstatus -L

With an open test.xls file in //server/scan my output looks like this:

[root@server ~]# smbstatus -L
Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
7020         1136001107  DENY_WRITE 0x13019f    RDWR       LEASE(RWH)       /var/lib/nethserver/ibay/scan   ~$test.xlsx   Tue Feb 20 13:28:14 2018
7020         1136001107  DENY_NONE  0x100081    RDONLY     NONE             /var/lib/nethserver/ibay/scan   .   Tue Feb 20 12:44:18 2018
7020         1136001107  DENY_NONE  0x100081    RDONLY     NONE             /var/lib/nethserver/ibay/scan   .   Tue Feb 20 12:45:07 2018
7020         1136001107  DENY_NONE  0x100081    RDONLY     NONE             /var/lib/nethserver/ibay/scan   .   Tue Feb 20 13:01:39 2018
7020         1136001107  DENY_WRITE 0x12019f    RDWR       LEASE(RWH)       /var/lib/nethserver/ibay/scan   test.xlsx   Tue Feb 20 13:28:14 2018

You can see that the xls file is locked DENY_WRITE. If I kill Excel now or send my PC to sleep the lock is just away and only the folder is locked anymore:

[root@server ~]# smbstatus -L
Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
7020         1136001107  DENY_NONE  0x100081    RDONLY     NONE             /var/lib/nethserver/ibay/scan   .   Tue Feb 20 12:44:18 2018
7020         1136001107  DENY_NONE  0x100081    RDONLY     NONE             /var/lib/nethserver/ibay/scan   .   Tue Feb 20 12:45:07 2018
7020         1136001107  DENY_NONE  0x100081    RDONLY     NONE             /var/lib/nethserver/ibay/scan   .   Tue Feb 20 13:01:39 2018
1 Like

Side note: That reminds me of

3 Likes

This is very useful info. I will test it and let you know the results.

Thank you!

1 Like