Sql-server – How to deny access to see the logins in a database

permissionssql serversql-server-2008-r2

I create a login in SQL Server 2008 R2, and when that user connects to a database, it can see all the logins in the security logins. Can I deny access to watch the logins of the database?

Best Answer

Either if it's a Windows or SQL login, then by default, if it has only the PUBLIC role, won't be able to see anything except SA and himself. No other login (Windows or SQL) on the machine will be visible, if he hasn't some other server permissions.

Example for that behavior (both test logins have only the Public role): new Windows user new SQL login the Sysadmin login

So, if a login can see more than himself, it must've had some privileges assigned. It should be in the login properties.

Some other easy way to see it is by scripting the login: right click -> script login as - create to - and see if it has any server role assigned to it (role assignments are at the end of the script).