unknown user has rights in the db's

  • Hi All,

    Help me solve this quiz. I removed individual user logins and introduced group logins of which is working well. I'm baffled by one whose account can drop and do more stuff, when i check under each db and security folder the user doesnt exist. all the groups are granted correct permission

    i ran xp_logininfo nothing of that user, what more can i check?

    thanks

    It's better to fail while trying, rather than fail without trying!!!

  • i'm thinking that your user is in a windows group that grants them permissions you didn't expect.

    this query seems to get all the individual mappings for all the groups i have added on my server;

    from there, i can query it and find myself, and what groups i belong to:

    IF OBJECT_ID('tempdb.dbo.#tmp') IS NOT NULL

    DROP TABLE #tmp

    CREATE TABLE [dbo].[#TMP] (

    [ACCOUNT NAME] NVARCHAR(256) NULL ,

    [TYPE] VARCHAR(8) NULL ,

    [PRIVILEGE] VARCHAR(8) NULL ,

    [MAPPED LOGIN NAME] NVARCHAR(256) NULL ,

    [PERMISSION PATH] NVARCHAR(256) NULL )

    DECLARE @groupname NVARCHAR(256)

    DECLARE c1 CURSOR FOR SELECT name FROM master.sys.server_principals WHERE type_desc = 'WINDOWS_GROUP' AND CHARINDEX('$',name) = 0

    OPEN c1

    FETCH NEXT FROM c1 INTO @groupname

    WHILE @@FETCH_STATUS <> -1

    BEGIN

    INSERT INTO #tmp([ACCOUNT NAME],[TYPE],[PRIVILEGE],[MAPPED LOGIN NAME],[PERMISSION PATH])

    EXEC master..xp_logininfo @acctname = @groupname,@option = 'members' -- show group members

    FETCH NEXT FROM c1 INTO @groupname

    END

    CLOSE c1

    DEALLOCATE c1

    SELECT * FROM [#TMP]

    --WHERE [MAPPED LOGIN NAME] = 'mydomain\Lowell'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • When You impersonate that user and tun SELECT USER_NAME(), what do you get?

    Next: what does sys.fn_mypermissions return?

    Andreas

    ---------------------------------------------------
    MVP SQL Server
    Microsoft Certified Master SQL Server 2008
    Microsoft Certified Solutions Master Data Platform, SQL Server 2012
    www.insidesql.org/blogs/andreaswolter
    www.andreas-wolter.com

  • Thanks for the response will test and advise

    It's better to fail while trying, rather than fail without trying!!!

  • I ran the command from his SSMS then return "guest" but the user guest is disabled from the user db's only active in the master and tempdb

    It's better to fail while trying, rather than fail without trying!!!

  • what do the following DMVs return?

    select * from sys.user_token

    select * from sys.login_token

    use impersonation, so you can copy the result

    ->

    execute as login = 'XYZ'

    Andreas

    ---------------------------------------------------
    MVP SQL Server
    Microsoft Certified Master SQL Server 2008
    Microsoft Certified Solutions Master Data Platform, SQL Server 2012
    www.insidesql.org/blogs/andreaswolter
    www.andreas-wolter.com

  • Please attachement when running user_token

    It's better to fail while trying, rather than fail without trying!!!

  • Well

    as you can see, your user is member of the Windows Group "Domain\SHR_Dev"

    and thereby member of the db_datareader database role inside this database

    But you said that at the same time that user's user-name is "guest"? This doesn't make sense at all to me. It should show up as "Domain\SHR_Dev".

    Also do a check for permissions for that individual with the function I provided..

    Andreas

    ---------------------------------------------------
    MVP SQL Server
    Microsoft Certified Master SQL Server 2008
    Microsoft Certified Solutions Master Data Platform, SQL Server 2012
    www.insidesql.org/blogs/andreaswolter
    www.andreas-wolter.com

  • when i ran it first time i was on the master db, then connected to the user db

    It's better to fail while trying, rather than fail without trying!!!

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply