Windows agent: access denied ([Errno 13] / [WinError 5]) on source folders is treated as a routine warning, so skipped folders go unnoticed
Description
Summary
On Windows, when the agent (running as LocalSystem) cannot read a folder that is part of the backup plan, borg reports [Errno 13] Permission denied (or [WinError 5]), skips the folder, and exits with code 1. The agent treats [WinError 5] as a "routine" warning, clears the error output and reports the job as a clean success. The result is a backup that silently misses entire folders while the dashboard shows green.
Environment
- BBS server: v2.102.0 (bare metal, Ubuntu 24.04)
- Agent: Windows Server 2025 Datacenter, borg 1.4.5-win1
- Service account: LocalSystem (default from install-windows.ps1)
Expected
The job should be flagged with warnings (or optionally failed) and list the paths that could not be read, so the admin knows the backup is incomplete.
Cause
This is a side effect of the fix for #236 (commit 2386857), which added "[WinError 5]" and "[Errno 13]" to routine_patterns in agent/bbs-agent.py to silence unactionable lockouts (NTUSER.DAT, special folders). That makes sense for those paths, but the same rule also hides user-selected data folders that are skipped because of their ACLs — which is actionable (granting SYSTEM access fixes it).
Proposal (either option would solve it)
- Per-plan or global setting, e.g. "Treat access-denied errors as warnings" (default: on), so MSP/file-server deployments can surface them.
- Smarter filter: keep suppressing access-denied only for a known list of system paths (NTUSER.DAT, UsrClass.dat,
System Volume Information,$Recycle.Bin, AppData caches, etc.) and flag access-denied on any other path as an actionable warning.
In both cases, it would help to include the list of skipped paths in the job details/notification.
Workaround
Grant SYSTEM access to the tree:
icacls "C:\Shared" /grant "*S-1-5-18:(OI)(CI)F" /T /C
Thanks for the great project!
Steps to Reproduce
- On a Windows file server, create
C:\Shared\Financewith inheritance disabled and permissions granted only to a domain/local group (SYSTEM not in the ACL). This is a very common setup on SMB file servers. - Add
C:\Sharedto a backup plan and run it. - The job finishes as "completed" with no warning. Browsing the archive shows
C:\Shared\Financemissing.
Installation Type
Bare metal (Ubuntu)
BBS Version
2.102.0
Agent Version (if applicable)
2.102.0
Agent OS (if applicable)
Windows
Relevant Logs
2026-11-24 11:38:10,026 [INFO] Executing backup job #16: C:\Program Files\BorgBackup\borg.exe create --json --log-json --list --progress --lock-wait=600 --exclude=*.tmp --exclude=*.cache --exclude=Thumbs.db --exclude=.DS_Store ssh://[email protected]/./repo-client1::plan1-2026-11-24_14-38-09 -- C:\Compartilhado
2026-11-24 11:38:10,470 [INFO] Progress target 1667 files (what the last backup stored)
2026-11-24 11:38:10,930 [INFO] Catalog SSH pipe opened for job 16
2026-11-24 11:38:24,909 [WARNING] borg: C:\Compartilhado\TI\4BARCODE.rar: open: [Errno 13] Permission denied: 'C:\\Compartilhado\\TI\\4BARCODE.rar'
2026-11-24 11:38:24,909 [WARNING] borg: C:\Compartilhado\TI\dlls.exe: open: [Errno 13] Permission denied: 'C:\\Compartilhado\\TI\\dlls.exe'
2026-11-24 11:38:24,909 [WARNING] borg: C:\Compartilhado\TI\Gertec_Full-Installer.zip: open: [Errno 13] Permission denied: 'C:\\Compartilhado\\TI\\Gertec_Full-Installer.zip'
2026-11-24 11:38:24,909 [WARNING] borg: C:\Compartilhado\TI\hp_LJP1100_P1560_P1600_Full_Solution-v20180815-50157037_1 (1).exe: open: [Errno 13] Permission denied: 'C:\\Compartilhado\\TI\\hp_LJP1100_P1560_P1600_Full_Solution-v20180815-50157037_1 (1).exe'
2026-11-24 11:38:24,909 [WARNING] borg: C:\Compartilhado\TI\imgCard_74bc386e-2aa0-41da-bbeb-03e9183afa4c_Driver Windows L42DT_7.4.3_M-5.exe: open: [Errno 13] Permission denied: 'C:\\Compartilhado\\TI\\imgCard_74bc386e-2aa0-41da-bbeb-03e9183afa4c_Driver Windows L42DT_7.4.3_M-5.exe'
2026-11-24 11:44:18,183 [INFO] Job #16 completed (borg exit 1 — only routine warnings)
Thanks @ricardodfg for the analysis; your second option is what v2.102.1 does. Access errors stay quiet only for files nobody can grant access to: registry hives, AppData, the compatibility folders such as My Music (recognised as junctions, so localized names count too), System Volume Information, $Recycle.Bin, and the macOS and Linux equivalents. Any other access error completes the job with warnings, and the job log lists each path. The Windows agent page now has your icacls fix.
I tested the classification against the lines in your log and in #236, but not on a Windows host. Please reopen if a folder you expect to see flagged stays quiet, or system noise comes back.