Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable SQL Server Management Studio for a user

Is there a way to prevent users from getting into SQL Server Management Studio so that they can't just edit table rows manually? They still need to access the tables by running my application.

like image 706
Jeff Stock Avatar asked May 22 '09 15:05

Jeff Stock


People also ask

Can we disable user in SQL Server?

Question: Is it possible to disable a user on a database or do they have to be removed totally? Answer: You don't need to remove a database user totally to disable them. A database user is associated with a SQL Server Login. So to disable a database user would requires a step to disable the login.

How temporarily disable SQL Server?

In SQL Server Configuration Manager, in the left pane, select SQL Server Services. In the results pane, right-click SQL Server (MSSQLServer) or a named instance, and then select Start, Stop, Pause, Resume, or Restart.

How do I disable SQL Server remote access?

Using SQL Server Management StudioIn Object Explorer, right-click a server and select Properties. Select the Connections node. Under Remote server connections, select or clear the Allow remote connections to this server check box.


1 Answers

You can use the DENY VIEW ANY DATABASE command for the particular user(s). This is a new feature available in SQL Server 2008.

It prevents the user from seeing the system catalog (sys.databases, sys.sysdatabases, etc.) and therefore makes the DB invisible to them in SQL Management Studio (SSMS).

Run this command from the Master Database:

DENY VIEW ANY DATABASE TO 'loginName'

The user is still able to access the database through your application. However, if they log in through SSMS, your database will not show up in the list of databases and if they open a query window, your database will not appear in the dropdown.

However, this is not fool-proof. If the user is smart enough to run the Query Command:

USE <YourDatabaseName>

Then they will see the database in the Query Analyzer.

Since this solution is taking you 90% there, I would give the database some obscure name not let the users know the name of the database.

like image 102
Jose Basilio Avatar answered Sep 22 '22 13:09

Jose Basilio