Nextcloud 20.0.4 SMB Errors because of file restrictions

Nextcloud version: 20.0.4
Operating system and version : Centos 8
Apache or nginx version: Apache/2.4.37 (centos)
PHP version: PHP 7.4.14

The issue you are facing:
I have a number of SMB shares setup using lib_smbclient. When I access them from my admin account which has access to all folders, it works fine. If I try a user account which has restricted access on a folder or file within that share then I get an error like below.

Is this the first time you’ve seen this error?: Yes but new install of version 20

Steps to replicate it:

  1. Access SMB share with an account which has NTFS ACL restricted access to a folder or file in the SMB share.
    The user is given an error “This directory is unavailable, please check the logs or contact the administrator”
  2. Users with full access do not experience the same issue or error.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"X-hvUWKnZe3OrcozyZU7oAAAAM4","level":4,"time":"2021-01-08T14:42:27+00:00","remoteAddr":"172.16.4.162","user":"A30F7848-394C-4FCE-B11F-5CA5B40B2AC7","app":"webdav","method":"PROPFIND","url":"/remote.php/dav/files/A30F7848-394C-4FCE-B11F-5CA5B40B2AC7/Client%20Transfers","message":{"Exception":"Icewind\\SMB\\Exception\\ForbiddenException","Message":"Invalid request for /PSondhi (ForbiddenException)","Code":13,"Trace":[{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":66,"function":"fromMap","class":"Icewind\\SMB\\Exception\\Exception","type":"::"},{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":78,"function":"handleError","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":109,"function":"testResult","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php","line":92,"function":"opendir","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":238,"function":"dir","class":"Icewind\\SMB\\Native\\NativeShare","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":610,"function":"getFolderContents","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"function":"getDirectoryContent","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php","line":408,"function":"iterator_to_array"},{"file":"/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php","line":388,"function":"handleChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php","line":340,"function":"scanChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/View.php","line":1345,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/View.php","line":1389,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":330,"function":"getFileInfo","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":805,"function":"getQuotaInfo","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/PropFind.php","line":96,"function":"Sabre\\DAV\\{closure}","class":"Sabre\\DAV\\CorePlugin","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":809,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"propFind","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1063,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":989,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1678,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1661,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":363,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":474,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":319,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":332,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/remote.php","line":167,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php","Line":30,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36","version":"20.0.4.0","id":"5ff8724a13de6"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 
  'passwordsalt' =>
  'secret' => 
  'trusted_domains' =>
  array (
    0 => ,
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.4.0',
  'overwrite.cli.url' => 
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin',
  'dbpassword' => 
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'share',
  'mail_domain' => 
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'app_install_overwrite' =>
  array (
    0 => 'occweb',
  ),
'memcache.local' => '\\OC\\Memcache\\APCu',

The output of your Apache/nginx/system log in /var/log/____:

I dont see anything in the apache log that looks relevant.

I figured out the issue, I had to enable the " Verify ACL access when listing files" checkbox.