Connecting to a SQL Server in a network via Command Line and Windows Authentication From RedHat Enterprise Linux Server 6.7 RRS feed

  • Question

  • sqlcmd -S "ServerName\\InstanceName,PortNumber" -d "DatabaseName" -E
    qlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Cannot generate SSPI context.
    Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL  SSPI Provider Cannot contact any KDC for realm Cannot contact any KDC for realm 'XX.XXX.XXXX.COM'
    • Edited by sqlPreacher Friday, March 18, 2016 2:26 PM missing information
    Friday, March 18, 2016 2:22 PM

All replies

  • Hello,

    Try using a SQL login as explained on the following article:


    Hope this helps.


    Alberto Morillo

    Friday, March 18, 2016 2:42 PM
  • Thank You SQLCoffee for your response...  

    But I am trying to connect though a Window Authentication account. For the above issues we had changed the Kerberos configuration on linux. Still we are not able to resolve the issues 


    Cheers, MAK

    Sunday, March 20, 2016 3:13 PM
  • Hi Newton7,

    Based on my research, the above error could be due to that no KDC responded in the requested realm. Make sure that at least one KDC is reachable or that the krb5kdc daemon is running on the KDCs. Check the krb5.conf file for the list of configured KDCs.

    For more details about Kerberos integrated authentication and Linux, please review the following articles.
    Using Integrated Authentication

    Lydia Zhang

    Lydia Zhang
    TechNet Community Support

    Monday, March 21, 2016 6:49 AM
  • This is what i see in cat krb5 confi file

    [root@XXXXX etc]# cat krb5.conf
    default = FILE:/var/log/krb5libs.log
    kdc = FILE:/var/log/krb5kdc.log
    admin_server = FILE:/var/log/kadmind.log

    default_realm = XX.XX.XXX.COM
    dns_lookup_realm = false
    dns_lookup_kdc = false
    ticket_lifetime = 24h
    renew_lifetime = 7d
    forwardable = true

    XX.XX.XX.COM = {
      kdc = XX.XX.XX.XXXX.com
      admin_server = XXXX.XX.XXXXX.XX.com

    .example.com = EXAMPLE.COM
    example.com = EXAMPLE.COM

    Cheers, MAK

    Monday, March 21, 2016 8:03 PM