On a Windows SMB file server, how do share-level and file-system permissions differ, and what does a denial of each look like in the audit log?
answer
- two gates, set in two places
- Read, Change, Full on the share
- an Everyone grant moves the work elsewhere
- only one denial logs a failure
- event 5145 and its failure condition
basics
~20 sA share has its own access list (Read, Change or Full), checked separately from the ACL on the files. Microsoft's event 5145 page says a failure is logged only for a share-level denial, never for a file-system one.
solid answer
~30 sThere are two separate checks. The **share** carries its own access list with the rights Read, Change and Full (`New-SmbShare -ReadAccess/-ChangeAccess/-FullAccess/-NoAccess`, or `Grant-SmbShareAccess -AccessRight`), and the **files and folders** carry their own file-system ACL. A request has to be evaluated against both. If the share grants Everyone Full Control, the share-level check stops being the restricting one and the file-system ACLs are where the real control lives. For auditing, Microsoft's event 5145 page says failure events appear only when access is denied at the share level, so a file-system denial will not show up as a 5145 failure.
go deeper
Recall that a share has its own Read, Change and Full list, separate from the file permissions on the folders.
Explain the two checks, the New-SmbShare and Grant-SmbShareAccess parameters, and which denial 5145 records as a failure.
Review a design with Everyone Full at the share by auditing the folder ACLs and choosing which audit subcategory will evidence each kind of denial.
Decide whether the estate standardises on one control point and what audit evidence that choice leaves.
## Two checks, two places When an SMB client connects to a share and opens a file, the Windows server consults two different access lists: - **The share's access list.** Created with the share and edited with the SmbShare cmdlets. It uses three rights: **Read**, **Change** and **Full**. - **The file-system ACL** on the folder and file being opened. It is stored with the files and folders themselves. The Microsoft pages used here describe the two checks but do not give a one-sentence rule for how their results combine, so describe the two checks and test effective access on the real server instead of reciting a rule from memory. ## Setting share permissions | Task | Cmdlet and parameter | |---|---| | Create a share and grant rights at once | `New-SmbShare -FullAccess`, `-ChangeAccess`, `-ReadAccess` take lists of accounts | | Create a share and explicitly refuse an account | `New-SmbShare -NoAccess` | | Add an entry to an existing share | `Grant-SmbShareAccess -AccessRight Full`, `Change` or `Read` | `New-SmbShare` documents one detail worth knowing: an account may not appear more than once across the Full, Change and Read lists, but it may appear once in one of those and once in `-NoAccess`. ## The scenario: Everyone Full at the share, real control in the ACLs A department share such as `Finance` on `files01.example.internal` is created with Everyone at Full at the share level, and the folder ACLs decide who can do what. Reading that design: 1. The share-level check will pass for every account whose token carries the Everyone SID. By default the token made for an anonymous connection does not include it, a separate setting covered in the anonymous-access question. 2. Every real restriction therefore lives in the file-system ACLs, so the review is a review of those ACLs, not of the share. 3. The share-level check can no longer produce a share-level denial, which matters for the audit trail below. ## What each denial leaves in the log Event **5145** ("A network share object was checked to see whether client can be granted desired access") is written by the `Audit Detailed File Share` subcategory, once per file or folder access. Its own page states the rule that matters here: failure events are generated **only when access is denied at the file share level**, and no events are generated when access is denied by the file-system ACL. | Denied by | 5145 failure logged? | |---|---| | The share's access list | Yes | | The file-system ACL | No | So with Everyone Full on the share, a user blocked by a folder ACL leaves no 5145 failure. If the auditor wants evidence of file-system denials you need another source. Microsoft's page points to the `Audit File System` subcategory for tracking access to files and notes that it excludes some details that `Audit Detailed File Share` has, such as the client's IP address. Check what it records on your server before promising denial evidence. ## Reading the three outcomes | Where the request is refused | What the user experiences | 5145 failure event | |---|---|---| | At the share's access list | The request is refused | Yes | | By the file-system ACL | The request is refused | No | | Nowhere | The file is opened | A success event, if success auditing is on | The first two rows look the same to the user, which is why a help-desk report of "access denied" cannot tell you which layer refused. The log can, but only for the first row. ## Samba's equivalents On Samba the share-level controls are smb.conf parameters: `valid users` (empty by default, meaning any user can log in to the service), `hosts allow` (the hosts permitted to access a service) and `guest ok` (default `no`; if `yes` no password is required). They are Samba's, not Windows's, and they sit alongside the file permissions of the host operating system. ## What to do in a review 1. List each share's access list and note any Everyone, Authenticated or broad group grant. 2. Review the ACL on the share's root folder and on each folder below that holds sensitive data. 3. Decide where denials must be evidenced and enable the matching audit subcategory. 4. Test with an account that should be refused, and read the resulting event, or its absence.
- A user reports access denied on a file inside the Finance share, but you find no 5145 failure for it. What does that tell you?It points to a file-system denial rather than a share-level one: Microsoft's 5145 page says failures are generated only for denials at the share level. Check the file-system ACL for the account and its groups, and use file-system auditing if you need evidence.
- Which cmdlet adds a Change entry to an existing SMB share's access list?`Grant-SmbShareAccess`, with `-Name` for the share, `-AccountName` for the trustee and `-AccessRight Change`. The accepted rights on that page are Full, Change and Read. `New-SmbShare` is for creating the share with `-ChangeAccess` and the other lists.
- The share permission is the only access control on a share
- A file-system denial always appears as a 5145 failure
- Everyone Full on the share means everyone can do anything
- Share and file-system permissions are the same list shown twice
- Grant-SmbShareAccess creates the share