I'm trying to create SQL Management Studio user permissions for different users and different databases. I want to make sure that every user can only see one database and this user will also have to be able to backup and restore their databases. I have been playing around with the server roles and user mapping, but I cannot seem to find the right settings. With the sysdmin server role, a user is able to perform a restore, but then that user is also able to access other databases.
Sql-server – SQL Management Studio user permissions with multiple databases
sql serverssms
Related Question
- Sql-server – Methods of Denying login by specific SQL Authenticated user using Management Studio
- Sql-server – Log in as another SQL Server user via SSMS to check their permissions
- Sql-server – Create a user account login that cannot login from SQL Server Management Studio
- Sql-server – Creating databases – no access to folder – MS SQL
- Sql-server – Assign Permissions to a SQL User
- Sql-server – User is in multiple Active Directory groups with multiple roles in database
- Sql-server – MS SQL: get permissions of a fixed server role
Best Answer
Privilege to backup the database part is straight forward.
You create 2 database:
Create 2 login:
Create 2 user from the login created above:
Make the users member of
db_backupoperator
in corresponding databases:Now
user1
can only take backup up ofdbuser
anduser2
fordbuser2
. Ifuser2
attempt to backupdbuser1
following error message will be issued. Msg 916, Level 14, State 1, Line 1For restore you have to add the users to
dbcreator
fixed server role. Thenuser2
can restoredbuser1
withREPLACE
option. That is something you do not want.There is few solution discussed here and hope you can implement one of these for restricting restore.