Guest Login Stops Working After a QNAP Firmware Update

It looks like a bug in Samba on QNAP

* This page contains promotional content

Environment where the problem happens

Model: TS-269 Pro
Old firmware: 4.3.4.1029
New firmware: 4.3.4.2351

File sharing from Windows10 and sharing over Mac SMB could no longer connect as guest.

Guest login worked on the old firmware, but after the new firmware guest login stopped working

Checking the settings

  • In Control Panel → Privilege settings, under “Edit Shared Folder Permission”, I confirmed that the files (folders) that should allow guest login have read/write checked for everyone
  • In Control Panel → Network & File Services, under “Microsoft Networking”, I confirmed that “Enable file service for Microsoft networking” is checked
  • I unchecked “Enable file service for Microsoft networking” and pressed the Apply button, then checked it again and pressed the Apply button (restarting the file sharing service)

Even after all of these checks, guest login does not work

Investigation

Since guest login works over Apple networking (AFP), I assumed the settings of the Windows sharing service (Samba) were at fault

  • Log in to the QNAP over SSH (I will skip how to connect)
  • Samba’s configuration file is /etc/smb.conf, but because of a symlink the real configuration file is /etc/config/smb.conf
  • Check inside /etc/config/smb.conf Confirmed “guest ok = yes” in the global section and in the guest login folder section

Where the problem is

The cause is that “invalid users = guest” is present in the global section inside smb.conf

  • Delete the “invalid users = guest” line inside smb.conf and try restarting Samba
  • Samba’s start/restart script is /etc/init.d/smb.sh
# /etc/init.d/smb.sh restart
  • Normally this setting should make guest login possible, but when I checked /etc/config/smb.conf after restarting Samba, the “invalid users = guest” I was supposed to have deleted had been inserted again.
    (Incidentally, you can also check the configuration file with the testparm command)

Workarounds and solutions

  1. Try rolling the firmware back (downgrading) to an older version However, it does not always fix things and it may cause side effects on other features, so it is not recommended

  2. From the QNAP admin screen

    • “Control Panel”
      • “Network & File Services”
        • Press “Advanced Options” for “Win/Mac/NFS” and set “Restrict anonymous users from accessing SMB shared folders” to disabled
        • I think this setting solves it in almost all cases
  3. If the item “Restrict anonymous users from accessing SMB shared folders” is not displayed (this was my case)

    1. Log in to the QNAP over SSH
    2. Back up /etc/init.d/smb.sh and edit the following single line around line 773
    /sbin/setcfg global "invalid users" "guest" -f ${CONFIG}
    ↓
    /sbin/setcfg global "invalid users" "" -f ${CONFIG}

    Finally restart with smb.sh restart, confirm with testparm that “invalid users = guest” is not in the global section, and try connecting over Samba

Things to note

With workaround 3 above, I expect the modified smb.sh to be reverted when the firmware is updated in the future, so if the same problem happens you will have to modify it again I hope the bug gets fixed in a future firmware update

References

Articles that were helpful for this problem