Logging in user in Windows 2008 server using LogonUser fails on LogonType LOGON32_LOGON_SERVICE

8,998

Ok, after deep research found that in the Local Security Policy, under User Right Assignment

"Log on as a service" should be granted to users logging in with LOGON32_LOGON_SERVICE logon type.

Share:
8,998
Ofiris
Author by

Ofiris

"Design and programming are human activities; forget that and all is lost." Stroustrup, Bjarne. The C++ Programming Language. pp. 693.

Updated on September 18, 2022

Comments

  • Ofiris
    Ofiris almost 2 years

    I am using LogonUser function to logon an account to Windows 2008 R2 server on a domain with clusterring.

    When using LOGON32_LOGON_INTERACTIVE as LogonType, I successfully login.

    When using LOGON32_LOGON_SERVICE as LogonType, Login fails, EventViewer says:

    An account failed to log on. Logon Type: 5

    Account For Which Logon Failed:

    Security ID:        NULL SID
    Account Name:       thename
    Account Domain:     thedomain
    Logon ID: 0x1009371c Logon Type: 5
    
    Failure Information:
    Failure Reason:     The user has not been granted the requested logon type at this machine.
    Status:         0xc000015b
    Sub Status:     0x0
    

    Was not sure if its for superuser or stackoverflow (calling LogonUser from C# code), but I guess its some Windows server issue*.

    EventID = 4625

    Edit: Found that - 0xc000015b The user has not been granted the requested logon type (aka logon right) at this machine

    Edit: Should be serverfault question...