Protect LocalDB from user access

后端 未结 1 655
面向向阳花
面向向阳花 2021-01-16 10:05

I\'m looking at using SQL LocalDB as the client side database which will replace the current SQL CE 3.5 database inside an in-house application developed in .net 4.

相关标签:
1条回答
  • 2021-01-16 10:19

    In fact, it shouldn't be so hard. Install SQL Server on client machine using local admin account. To make you life easier, use Mixed Authentication.

    After you have your instance installed, local admin account should have sysadmin server role assigned (that's normal security settings). Now, use the following:

    1. Create new SQL Server user and assign sysadmin server role to that account. Close SSMS and log-in using new credentials. Or simply use sa account (not so good practice but in this case it's OK).

    2. Go to "Security - Logins" and remove sysadmin role from local admin. Also, check in user mappings and take all rights "away" from local admin.

    As a test, try to log-in as local admin, I guess you won't be able to log-in into server because there is no "home" database for that user. But even if you can log-in, it has only "public" role.

    It's up to you to install your database and secure it - assign permission to user of your choice.

    Regarding you fear that local admin can install MSSQL again: he/she can install it, but it would be another instance. That instance knows nothing about users in your instance so you should be safe.

    You can also consider usage of application roles in SQL server.

    0 讨论(0)
提交回复
热议问题