DATOMILAB

Troubleshooting

Fix SQL Server error 3201: operating system error 5 (access denied)

Error 3201 with OS error 5 means the SQL Server service account cannot write to the backup path. Find that account and grant the right permissions.

Updated 27 Sep 2026 5 min read By the DatomiLab team

This error means SQL Server could not create or open the backup file because Windows refused access. The fix is almost always to give the SQL Server service account write permission on the folder. Your own permissions do not matter here.

The error

Error message
Msg 3201, Level 16, State 1, Line 1
Cannot open backup device 'D:\Backups\Sales.bak'. Operating system error 5(Access is denied.).
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.

The same error appears on restore when SQL Server cannot read the .bak file.

Why your permissions are not the point

When you run BACKUP DATABASE, the SQL Server service writes the file, under its own Windows account. You might be a local administrator, but the service is not. So the question is: can the service account write to that folder?

Step 1: find the service account

T-SQL
SELECT servicename, service_account
FROM sys.dm_server_services;

Typical results:

InstanceUsual service account
Default instanceNT Service\MSSQLSERVER
Named instance, e.g. SQLEXPRESSNT Service\MSSQL$SQLEXPRESS
CustomA domain or local user you chose at install time

Step 2: grant write access to a local folder

From an administrator command prompt (change the account and path to match yours):

Command prompt (run as administrator)
icacls "D:\Backups" /grant "NT Service\MSSQLSERVER":(OI)(CI)M

(OI)(CI) makes the permission apply to files and subfolders created later. M is Modify, which covers creating, writing and deleting backup files. In the GUI, do the same from the folder's Properties > Security > Edit > Add. Type the account name exactly, with the location set to the local computer.

Step 3: for a network share, grant the computer account

Built-in virtual accounts such as NT Service\MSSQLSERVER reach the network as the server's computer account, DOMAIN\SQLSERVER01$. Grant that account:

  • Share permissions: Change (or Full Control).
  • NTFS permissions on the target folder: Modify.

Without a domain, computer accounts cannot be used. Run SQL Server under a named local account, create the same user name and password on the NAS, and grant it access there. Always use a UNC path (\\nas\backups), never a mapped drive letter.

Other operating system errors with 3201

OS errorMeaningFix
2 or 3File or path not foundThe folder must exist on the SQL Server machine. A path on your laptop does not count.
32File in use by another processAnother job or an antivirus scan has the file open. Use unique file names per backup.
53 or 67Network path not foundCheck the server name, DNS and that the share exists
112Disk fullFree space or add retention cleanup

Avoid the root of C:

Backing up directly to C:\ is blocked for most service accounts, and a backup on the system disk is a poor idea anyway. Use a dedicated folder on another disk, set up once with the right permissions, and point every job there.

With Velocity

Velocity writes SQL Server backups to the server's default backup directory, which the SQL Server service account can already write to. It then copies each backup to your chosen destinations: a local folder, FTP/FTPS or Google Drive. That avoids most permission errors from the start.