mban94
mban94

Reputation: 754

SQL Server on Ubuntu 18.04 Operating system error 2(The system cannot find the file specified.)

I am trying to backup database on sql server with :BACKUP DATABASE [mydb] TO DISK = N'/path/to/file.bak' WITH NOFORMAT, NOINIT, NOSKIP, REWIND, NOUNLOAD, STATS = 10

It creates backup if the path is /var/opt/mssql/data/file.bak cannot create backup in any other location. Is this a permission issue? Does any one had faced the same? Thanks in advance.

Upvotes: 4

Views: 3488

Answers (1)

Thom A
Thom A

Reputation: 95924

SQL Server on Linux (on Ubuntu) runs under the user mssql. If you want SQL Server to be able to write to that folder, then either the user/group mssql needs write acces to the folder (and able to read/execute any parent folders), the mssql user needs to be part of a group that can, or the permissions for others needs to be set to write. Again, all parent folders need to allow access (read/execute).

If you had a Folder /backups, for example, owned by root: with the permissions 770, and then a folder /backups/SQLServer/ owned by root:mssql with the permission 775, then SQL Server would be unable to write to the folder, as it wouldn't have been able to navigate to the folder /backups.

Upvotes: 6

Related Questions