How to detect if the guest account is disabled

29 November,2021 by Tom Collins

A common  SQL Server Security check is to identify if the  guest id is enabled.        By default  , the SQL Server  guest id is disabled , but for various reasons it can become enabled. 

To identify the guest status you can either use the SQL Server Management Studio (SSMS) or through SQL code. 

Check for guest status through SSMS

Guest

Check guest status through sql code 

 

SELECT name, hasdbaccess
FROM sys.sysusers
WHERE name = 'guest'


To change the guest status 

 

GRANT CONNECT TO guest 
REVOKE CONNECT FROM guest

Read more on SQL Security 

How to check the SQL sa Login is disabled

5 easy ways to protect SQL Server against Ransomware attacks

Find Weak passwords in SQL Server


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to detect if the guest account is disabled


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer