none
kinit command is not able to fetch/read C:\Windows\krb5.ini file on widnows 2012 server R2

    Question

  • Hi

    In order to get a Kerberos ticket, I have created krb5.ini file (*1) on Windows server 2012 machine (*1) at location C:\windows\krb5.ini, but while trying to execute kinit command by Administrator user below error occurred:

    Exception: krb_error 0 Could not load configuration file c:\winnt\krb5.ini (The system cannot find t
    he path specified) No error
    KrbException: Could not load configuration file c:\winnt\krb5.ini (The system cannot find the path s
    pecified)
            at sun.security.krb5.Config.<init>(Config.java:143)
            at sun.security.krb5.Config.getInstance(Config.java:75)
            at sun.security.krb5.internal.tools.Kinit.<init>(Kinit.java:137)
            at sun.security.krb5.internal.tools.Kinit.main(Kinit.java:106)
    Caused by: java.io.FileNotFoundException: c:\winnt\krb5.ini (The system cannot find the path specified)

    (*1) krb5.ini is as follows:

    [libdefaults]
     default_realm = domain name
    dns_lookup_kdc = true
    dns_lookup_realm = true
     default_keytab_name = FILE:<keytab file location>
            default_tkt_enctypes = rc4-hmac
            default_tgs_enctypes = rc4-hmac
    [realms]
            domain name = {
       kdc = machine name.domain name
                  default_domain = domain name       
    }

    Please help.

    Thank You

    Wednesday, December 21, 2016 1:00 PM

Answers

  • Hi Programmer1982,

    It's important to keep in mind here that the 'kinit' command is not native to Microsoft Windows.  It's a Java command.  From what I've found, you have two possible solutions.

    #1 - Easy one:

    Create a C:\winnt folder and place the krb5.ini into that.

    #2 - Slightly more effort, but more elegant than #1:

    Create a User or System environment variable for location of krb5.ini so you don't have to copy to C:\winnt.  To understand how to set Windows environment variables, see this reference

    Variable Name = _JAVA_OPTIONS 
    Variable Value = -Djava.security.krb5.conf=C:\Windows\krb5.ini

    Reference: how to move krb5.ini file away from c:\winnt


    Best Regards, Todd Heron | Active Directory Consultant


    • Edited by Todd Heron Saturday, January 7, 2017 2:51 PM
    • Proposed as answer by Net-bel Wednesday, January 11, 2017 7:44 PM
    • Marked as answer by Programmer1982 Friday, January 20, 2017 2:16 PM
    Saturday, January 7, 2017 2:50 PM

All replies

  • Hi,

    >>KrbException: Could not load configuration file c:\winnt\krb5.ini (The system cannot find the path s
    pecified)

    From these errors to see, your java script program couldn't find the related krb5.ini file in there environment variable.

    In windows, you could check the related environment variable path by opening powershell then run: $env:path to check if these files is remained in the path.

    Otherwise, you could manually add these ini file into your intelligent developing tool, for instance: eclipse.

    Besides, for how to use kinit  command you could refer to related link:

    http://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.cmds3/kinit.htm

    Please note: This website is not provided by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Thursday, December 22, 2016 7:24 AM
    Moderator
  • Thank you very much for your reply.

    In the PATH environment variable %SystemRoot% is already added, which is directing to the location C:\windows.

    and krb5.ini file is located at "C:\Windows" location but while executing the kinit command error as mentioned in the above thread occurred.

    can you please suggest in which environment variable location C:\Windows to be added therefore kinit command can be executed successfully.

    Thank you

    Wednesday, January 4, 2017 10:41 AM
  • Hi Programmer1982,

    It's important to keep in mind here that the 'kinit' command is not native to Microsoft Windows.  It's a Java command.  From what I've found, you have two possible solutions.

    #1 - Easy one:

    Create a C:\winnt folder and place the krb5.ini into that.

    #2 - Slightly more effort, but more elegant than #1:

    Create a User or System environment variable for location of krb5.ini so you don't have to copy to C:\winnt.  To understand how to set Windows environment variables, see this reference

    Variable Name = _JAVA_OPTIONS 
    Variable Value = -Djava.security.krb5.conf=C:\Windows\krb5.ini

    Reference: how to move krb5.ini file away from c:\winnt


    Best Regards, Todd Heron | Active Directory Consultant


    • Edited by Todd Heron Saturday, January 7, 2017 2:51 PM
    • Proposed as answer by Net-bel Wednesday, January 11, 2017 7:44 PM
    • Marked as answer by Programmer1982 Friday, January 20, 2017 2:16 PM
    Saturday, January 7, 2017 2:50 PM