Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.
The guest account exists in all your databases. This is installed by default, and guest is used to map a login that doesn’t otherwise have access to a database.
It should. This would be bad if any login could connect to any database, potentially reading data using the guest account. Fortunately Microsoft has done two things. First, guest is disabled in all user databases. This is because it’s disabled in model, which is our template.
Second, guest is typically assigned no rights. It’s a member of the public role, which also has no rights by default.
If you want to allow anonymous access for logins through the guest account, it’s easy. Be wary and careful of doing this and be sure you understand what rights have been granted to public if you do this. In general, I’d expect auditors and any compliance/security officers to be against this, but you should check.
The user exists already, and just needs the CONNECT permission to get enabled. You can do this with this code:
GRANT CONNECT TO guest
If you want to remove permission, use
REVOKE CONNECT FROM guest
That’s it. Remember, by default this user can’t access any objects. I would recommend you not grant rights to guest, but use roles. Either one of the built in ones, or better yet, create your own role and choose limited permissions.
One of the ways you can showcase your knowledge, show you’re learning, and show you’re motivated to enhance your career is blogging. This post is an example of what you could write, in your own words, about something you’ve learned.
This one took my about 5 minutes after I’d spent a little time getting guest enabled for a test project.