In MS-SQL 2005 when i exec
select * from sys.sysusers
in master database , guest user hasdbaccess = 1 .
how to set hasdbaccess = 0 ?
In MS-SQL 2005 when i exec
select * from sys.sysusers
in master database , guest user hasdbaccess = 1 .
how to set hasdbaccess = 0 ?
I suppose it's not as simple as:
update sys.sysusers
set hasdbaccess = 0
where user = 'guest'
or something similar? No, life is never that easy :-)
You would normally use deny
or revoke
to remove such permissions but be aware that guest is not considered a regular user. For some reason, GUEST
is not subject to REVOKE CONNECT
on the master or tempdb databases.
See here for that little statement of fact but not much explanation as to why.
On further investigation, some people seem to suggest that it's required on the master DB because that's where the user (login) information is stored. So, during login, everyone accesses that DB with the guest account since their 'real' account and permissions are not yet known.
Because the guest account is used for all users without validated credentials (and that's everyone up until the point where their login succeeds), that makes sense to me.