Win32 Service Logon Failure

Discussion in 'Ruby' started by Ashish Deepak4, Feb 3, 2011.

  1. Hi Guys,

    I desperately need help with this as I can't understand why it is
    working.

    I am trying to create windows service using win32/service with a
    specific user login. I have provided the username and password correctly
    in my ruby script.

    Essentially, when i run the script below it successfully creates the
    service. But fails to start saying "Logon Failure" message. However,
    if I go to the windows service window (services.msc) and right click
    service and then go to properties->Log On and enter the same password
    and then start the service it all works fine.
    Please help if you have ever encounter this before? I do not understand
    what is going on. (I am logged in as Adminstrator when I run this
    script)

    myService.ruby
    ------------------------------------------------------------------------

    require "win32/service"
    include Win32

    Service.create("MyService", nil,
    :description => "My Ruby Service",
    :start_type => Service::AUTO_START,
    :error_control => Service::ERROR_NORMAL,
    :binary_path_name => "C:\myService.exe",
    :display_name => "MyService",
    :service_start_name => "domain\\myUser",
    :password => "myPass",
    :service_type=> Service::SERVICE_WIN32_OWN_PROCESS
    )


    Service.start("MyService")

    --
    Posted via http://www.ruby-forum.com/.
     
    Ashish Deepak4, Feb 3, 2011
    #1
    1. Advertising

  2. Ashish Deepak4 wrote in post #979326:
    > Hi Guys,
    >
    > I desperately need help with this as I can't understand why it is
    > working.
    >
    > I am trying to create windows service using win32/service with a
    > specific user login. I have provided the username and password correctly
    > in my ruby script.
    >
    > Essentially, when i run the script below it successfully creates the
    > service. But fails to start saying "Logon Failure" message. However,
    > if I go to the windows service window (services.msc) and right click
    > service and then go to properties->Log On and enter the same password
    > and then start the service it all works fine.
    > Please help if you have ever encounter this before? I do not understand
    > what is going on. (I am logged in as Adminstrator when I run this
    > script)
    >
    > myService.ruby
    > ------------------------------------------------------------------------
    >
    > require "win32/service"
    > include Win32
    >
    > Service.create("MyService", nil,
    > :description => "My Ruby Service",
    > :start_type => Service::AUTO_START,
    > :error_control => Service::ERROR_NORMAL,
    > :binary_path_name => "C:\myService.exe",
    > :display_name => "MyService",
    > :service_start_name => "domain\\myUser",
    > :password => "myPass",
    > :service_type=> Service::SERVICE_WIN32_OWN_PROCESS
    > )
    >
    >
    > Service.start("MyService")


    Found the solution.
    You have to grant the user the SeServiceLogonRight permission first
    before staring the service.
    I did this using ntrights.exe.

    Found following pages helpful:
    http://www.questionhub.com/ServerFault/197881
    http://support.microsoft.com/kb/315276

    --
    Posted via http://www.ruby-forum.com/.
     
    Ashish Deepak4, Feb 10, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Wallace

    Logon Failure

    Scott Wallace, Oct 3, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    523
    Paul Todd
    Oct 6, 2003
  2. Brad

    Logon Failure

    Brad, Aug 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    433
  3. =?Utf-8?B?cmZvbnRhaW5l?=

    logon failure to a remote share with a virtual directory

    =?Utf-8?B?cmZvbnRhaW5l?=, Sep 30, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,787
    =?Utf-8?B?cmZvbnRhaW5l?=
    Sep 30, 2004
  4. Kjell Kristiansson
    Replies:
    0
    Views:
    314
    Kjell Kristiansson
    Nov 30, 2005
  5. Tim Gee

    Web Service: Logon failure

    Tim Gee, Mar 5, 2007, in forum: ASP .Net Security
    Replies:
    0
    Views:
    142
    Tim Gee
    Mar 5, 2007
Loading...

Share This Page