{"id":556,"date":"2021-02-26T13:55:58","date_gmt":"2021-02-26T19:55:58","guid":{"rendered":"http:\/\/computing.fnal.gov\/lqcd\/?page_id=556"},"modified":"2021-09-21T09:46:58","modified_gmt":"2021-09-21T14:46:58","slug":"troubleshooting-kerberos-kinit-problems","status":"publish","type":"page","link":"https:\/\/computing.fnal.gov\/lqcd\/troubleshooting-kerberos-kinit-problems\/","title":{"rendered":"Kerberos and SSH troubleshooting"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Troubleshooting Kerberos kinit problems<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><span class=\"has-inline-color has-black-color\">Error message:<\/span><span class=\"has-inline-color has-vivid-red-color\">&nbsp;kinit: krb5_get_init_creds: Error from KDC: CLIENT EXPIRED<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong><strong>&nbsp;<\/strong>Your Kerberos account has expired.<\/p>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;Please see the&nbsp;<a href=\"https:\/\/computing.fnal.gov\/lqcd\/user-accounts\/#RenewingyourVisitorIDandKerberosaccount\">User Accounts web page<\/a>&nbsp;for more information on renewing your Kerberos account.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit(v5): Cannot find KDC for requested realm while getting initial credentials<\/span><\/pre>\n\n\n\n<p><strong>Problem:&nbsp;<\/strong><code>\/etc\/krb5.conf<\/code>&nbsp;file does not contain <code>.FNAL.GOV<\/code> information.<\/p>\n\n\n\n<p><strong>Solutions:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Replace&nbsp;<code>\/etc\/krb5.conf<\/code>&nbsp;with your OS-specific&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/authentication.fnal.gov\/krb5conf\/\" target=\"_blank\">Fermilab-supplied version of krb5.conf<\/a>.<\/li><li>Modify&nbsp;<code>\/etc\/krb5.conf<\/code>&nbsp;adding Fermilab-specific stanzas as instructed in the&nbsp;<a href=\"https:\/\/computing.fnal.gov\/lqcd\/user-accounts\/#Kerberossoftwareinstallation\">User Accounts web page<\/a>.<\/li><li>If you do not have permission to modify&nbsp;<code>\/etc\/krb5.conf<\/code>, copy&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/authentication.fnal.gov\/krb5conf\/\" target=\"_blank\">Fermilab-supplied version<\/a>&nbsp;into your home area, and execute&nbsp;<code>export KRB5_CONFIG=$HOME\/krb5.conf<\/code>&nbsp;to tell all Kerberos commands to use the user&#8217;s copy of <code>krb5.conf<\/code>.<\/li><\/ol>\n\n\n\n<p><strong>Related problem:<\/strong><\/p>\n\n\n\n<p>On Macintosh computers, Kerberos is installed on all recent versions. However, there are two locations and names for krb5.conf,<\/p>\n\n\n\n<p>\/etc\/krb5.conf<\/p>\n\n\n\n<p>and<\/p>\n\n\n\n<p>\/Library\/Preferences\/edu.mit.Kerberos<\/p>\n\n\n\n<p>(Note: the file in&nbsp;\/Library&nbsp;is named&nbsp;edu.mit.Kerberos, not&nbsp;krb5.conf.) Either will work, but you should only have one.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: Unable to acquire credentials for 'user@FNAL.GOV': Cannot contact any KDC for realm 'FNAL.GOV'<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;You are behind a firewall or are using an internet connection which has a &#8220;NAT&#8221; (Network Address Translation), such as on a home wireless router.<\/p>\n\n\n\n<p><strong>Solutions:<\/strong><\/p>\n\n\n\n<p><strong>Step 1:<\/strong>&nbsp;Check your connectivity, as shown below, to one of the Fermilab Kerberos authentication servers (such as&nbsp;<code>krb-fnal-1.fnal.gov<\/code>) to make sure you can reach the server at the other end. If successful move to step 2. If fail, send us email at&nbsp;<a href=\"mailto:lqcd-admin@fnal.gov\">lqcd-admin@fnal.gov<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[@mylaptop ~]$ telnet krb-fnal-1.fnal.gov 88\nTrying 131.225.110.105...\nConnected to krb-fnal-1.fnal.gov.\nEscape character is '^]'.\n^]\n&nbsp;\ntelnet&gt; quit\nConnection closed.<\/pre>\n\n\n\n<p>OR, in case of some mac OS versions that are missing the&nbsp;<code>telnet<\/code>&nbsp;utility, use the&nbsp;<code>nc<\/code>&nbsp;utility as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[@mylaptop ~]$ nc -vz krb-fnal-1.fnal.gov 88\nConnection to krb-fnal-1.fnal.gov port 88 [tcp\/kerberos] succeeded<\/pre>\n\n\n\n<p><strong>Step 2:&nbsp;<\/strong>Request an address-less Kerberos ticket as follows:<\/p>\n\n\n\n<p>      kinit -a username@FNAL.GOV<\/p>\n\n\n\n<p>If you do<\/p>\n\n\n\n<p>      klist -a<\/p>\n\n\n\n<p>you should see as the last line<\/p>\n\n\n\n<p>     Addresses: (none)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: Preauthentication failed while getting initial credentials<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;<code>kinit<\/code>&nbsp;fails with preauthentication error.<\/p>\n\n\n\n<p><strong>Solutions:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Usually the problem is simply that you have typed in your kerberos password incorrectly. Please try again.<\/li><li>If you have lost your kerberos password, call the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/servicedesk.fnal.gov\/\" target=\"_blank\">Fermilab Service Desk<\/a>&nbsp;at (630) 840 2345, during business hours to have the password reset.<\/li><li>Occasionally this is not a password problem, but a problem with your system&#8217;s clock. Make sure that the&nbsp;<code>date<\/code>&nbsp;command returns a time correct to within 5 minutes.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: krb5_get_init_creds: Too large time skew<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;kinit&nbsp;fails with time skew message.<\/p>\n\n\n\n<p><strong>Solution:<\/strong><\/p>\n\n\n\n<p>Your system clock must be within 5 minutes of the correct value.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: KDC has no support for encryption type while getting initial credentials<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;kinit&nbsp;fails with complaint about encryption type.<\/p>\n\n\n\n<p><strong>Solutions:<\/strong><\/p>\n\n\n\n<p>This problem appears on recent Ubuntu and related Linux distributions. To fix, edit<code>&nbsp;\/etc\/krb5.conf<\/code>&nbsp;file, and in the&nbsp;<code>[libdefaults]<\/code>&nbsp;section add<\/p>\n\n\n\n<p>allow_weak_crypto = true<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: Client not found in Kerberos database while getting initial credentials<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;<code>kinit<\/code>&nbsp;fails with database complaint.<\/p>\n\n\n\n<p><strong>Solutions:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Your kerberos principal may differ from your username on your local system. Use&nbsp;<code>kinit username@FNAL.GOV<\/code>&nbsp;where username is your Fermilab kerberos principle.&nbsp;<code>kinit<\/code>&nbsp;without options will default to using your local username.<\/li><li>Your Fermilab ID or Visitor ID has expired. Please see the&nbsp;<a href=\"https:\/\/computing.fnal.gov\/lqcd\/user-accounts\/#RenewingyourVisitorIDandKerberosaccount\">User Accounts web page<\/a>&nbsp;for more information on renewing your Fermilab ID.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: Client's entry in database has expired<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;<code>kinit<\/code>&nbsp;fails because of an expired password<\/p>\n\n\n\n<p><strong>Solutions:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You must change your kerberos password once a year with the&nbsp;<code>kpasswd<\/code>&nbsp;command. You can try to change your password, even if it is expired, by using&nbsp;<code>kpasswd<\/code>&nbsp;on your local machine. More detailed instructions are&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/fermi.servicenowservices.com\/kb_view_customer.do?sysparm_article=KB0010628\" target=\"_blank\">available here<\/a>.<\/li><li>You can also call the Fermilab Service Desk at&nbsp;(630) 840 2345, during business hours to have the password reset.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">kinit: Password incorrect<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;If you are sure your Kerberos password is correct but you are on a MAC OS 10.10 (Yosemite)&nbsp;<code>kinit<\/code>&nbsp;will fail because the Kerberos pass phrase is DES encoded, which Yosemite no longer accepts.<\/p>\n\n\n\n<p><strong>Solutions:&nbsp;<\/strong><\/p>\n\n\n\n<p>You will need to reset your Kerberos password as follows:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You have access to a non-Yosemite machine with Kerberos client software installed, do&nbsp;<code>kinit<\/code>&nbsp;to obtain a Kerberos ticket and then SSH to one of our head nodes, for example&nbsp;<code>lq.fnal.gov<\/code>. Once there do a&nbsp;<code>kpasswd<\/code>&nbsp;to change your Kerberos password. Alternatively, you may call the Fermilab Service Desk at&nbsp;(630) 840 2345, during business hours and request that they reset your kerberos password.&nbsp;<\/li><li>Update the&nbsp;<code>krb5.conf<\/code>&nbsp;file on your Yosemite machine with the latest version from&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/authentication.fnal.gov\/krb5conf\/\" target=\"_blank\">Fermilab-supplied version posted here<\/a>.<\/li><li>On your Yosemite machine, go ahead and attempt&nbsp;<code>kinit<\/code>&nbsp;and&nbsp;<code>ssh<\/code>, which should now work.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Troubleshooting SSH problems<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">ssh_dispatch_run_fatal: Connection to 131.225.202.32: unexpected internal error<\/span><\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;You may have just upgraded to the latest Mac OS X version or changed the SSH options on your client.<\/p>\n\n\n\n<p><strong>Solution:<\/strong>\u00a0Try to &#8220;<code>ssh -o GSSAPIKeyExchange=no lq.fnal.gov<\/code>&#8221;\u00a0to one of our servers. If it works then add &#8220;<code>GSSAPIKeyExchange no<\/code>&#8221;\u00a0to your SSH client config file (e.g. <code>\/etc\/ssh\/ssh_config<\/code>).<\/p>\n\n\n\n<p><strong>See also<\/strong>: The CMS support group has posted some information specifically addressing the upgrade to Mac OS Big Sur. <a href=\"https:\/\/uscms.org\/uscms_at_work\/physics\/computing\/getstarted\/uaf.shtml#MacBigSur\" target=\"_blank\" rel=\"noreferrer noopener\">Visit their troubleshooting page <\/a>for more information on changes with Big Sur and issues with Anaconda affecting Kerberos authentication.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error message: <span class=\"has-inline-color has-vivid-red-color\">permission denied<\/span><\/pre>\n\n\n\n<p>SSH login failures will be indicated by a&nbsp;permission denied&nbsp;message. If none of the solutions below fixes your problem please email the output of the command &#8220;<code>ssh -vvv lq.fnal.gov<\/code>&#8221;&nbsp;to <a href=\"mailto:lqcd-admin@fnal.gov\">lqcd-admin@fnal.gov<\/a>&nbsp;for further assistance.<\/p>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;Kerberos client and SSH using different credential cache file locations.<\/p>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;We have mostly encountered this on MAC 10.9.x versions where Kerberos clients are installed from two different sources. In such a situation Kerberos client binaries end up in&nbsp;\/opt\/local\/bin&nbsp;and in&nbsp;\/usr\/bin. Use the Kerberos client&nbsp;kinit&nbsp;installed in&nbsp;\/usr\/bin&nbsp;to obtain a Kerberos ticket. Also make sure there is a subdirectory&nbsp;.ssh&nbsp;in your home directory. Make sure the subdirectory has a file named&nbsp;config&nbsp;with the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Host *.fnal.gov\nGSSAPIAuthentication yes\nGSSAPIDelegateCredentials yes\nGSSAPITrustDNS yes<\/pre>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;Not having a kerberos ticket granting ticket (TGT), or having an expired TGT.<\/p>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;Verify with the&nbsp;klist -f&nbsp;command that you have a ticket. If you don&#8217;t have a ticket, or have an expired ticket, get a new ticket with&nbsp;kinit&nbsp;as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lqcdp4ee:~$ kinit -fr 7d username@FNAL.GOV\nlqcdp4ee:~$ klist -f\nTicket cache: \/tmp\/krb5cc_1234\nDefault principal: username@FNAL.GOV\n&nbsp;\nValid starting \u00b7\u00b7 Expires\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7 Service principal\n08\/17\/12 09:31:16 08\/18\/12 11:31:16 krbtgt\/FNAL.GOV@FNAL.GOV\nrenew until 08\/24\/12 09:31:09, Flags: FRIA<\/pre>\n\n\n\n<p>Normal output, indicating that a forwardable, renewable, ticket exists. Check the expiration time &#8211; if the current time is past the expiration, login attempts will fail.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lqcdp4ee:~$ klist -f\nklist: No credentials cache file found (ticket cache \/tmp\/krb5cc_5598)<\/pre>\n\n\n\n<p>If you see the above message you&nbsp;do not have a Kerberos ticket. Use&nbsp;kinit&nbsp;to get a ticket before attempting to login. Kerberos tickets expire after 24 hours. If you include the&nbsp;-r 7d&nbsp;switch on your&nbsp;kinit&nbsp;command line, you will receive a renewable ticket. Renewable tickets may be renewed by typing&nbsp;kinit -R&nbsp;before they expire at the end of any 24 hour period. Tickets are renewable for up to the period specified in the&nbsp;-r&nbsp;switch, to a maximum of 7 days.<\/p>\n\n\n\n<p>Another useful switch to&nbsp;kinit&nbsp;is&nbsp;-f, which asks for a forwardable ticket. If you have a forwardable ticket, once you login to a Fermilab machine, say&nbsp;lq.fnal.gov, you can then login from&nbsp;lq&nbsp;to another machine without executing a new&nbsp;kinit. It is in general a bad idea to use&nbsp;kinit&nbsp;on any machine but your local system, as your password may be captured as it traverses the internet. The only time typing a&nbsp;kinit&nbsp;password is safe on a remote machine is when you are using an encrypted connection, like with&nbsp;ssh.<\/p>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;Not having an account on the target machine, or having an account on the target machine under a different username.<\/p>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;A permission denied error will occur if you do not have an account on the target machine, or if your username on the target machine differs from your username on your local machine. Try<\/p>\n\n\n\n<p>ssh username@lq.fnal.gov<\/p>\n\n\n\n<p>or<\/p>\n\n\n\n<p>ssh -l username lq.fnal.gov<\/p>\n\n\n\n<p>where username is your Fermilab username (the same name that you used in your&nbsp;kinit&nbsp;command). If this fails, send e-mail to&nbsp;<a href=\"mailto:lqcd-admin@fnal.gov\">lqcd-admin@fnal.gov<\/a>&nbsp;and ask that the administrators verify that you have a valid account on the Fermilab lattice QCD systems.<\/p>\n\n\n\n<p><strong>Problem:&nbsp;<\/strong>Using an internet connection which has a &#8220;NAT&#8221; (Network Address Translation), such as on a home wireless router<\/p>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;Nearly all home routers, wired or wireless, have a &#8220;NAT&#8221; function, which results in your local system having a different local network address than what is presented to remote machines. This allows you to have multiple local machines and only one external IP address. Your local addresses will generally be something like 192.168.X.Y, or 10.X.Y.Z, when a NAT is present.<\/p>\n\n\n\n<p>With a NAT, your&nbsp;ssh&nbsp;logins may fail with&nbsp;Incorrect net address. To fix this, use &#8220;address-less&#8221; tickets. First, use&nbsp;kdestroyto delete your current ticket. Then, use&nbsp;kinit&nbsp;with&nbsp;-a,&nbsp;-A, or&nbsp;-n&nbsp;to request an address-less ticket. The switch required varies with kerberos versions, so use&nbsp;man kinit&nbsp;on your local system to determine which of these three switches to use.<\/p>\n\n\n\n<p>For Mac OS users, please be aware that the default behaviour on Mac OS is to supply address-less tickets, so you should also be able to simply drop the&nbsp;-A&nbsp;or&nbsp;-a&nbsp;switch entirely.<\/p>\n\n\n\n<p><strong>Problem:<\/strong>&nbsp;Using an SSH client which&nbsp;does not have&nbsp;Kerberos authentication enabled<\/p>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;Some versions of ssh will not attempt to perform kerberos authentication. In this case, you will receive a&nbsp;permission denied&nbsp;error. To enable kerberos authentication, try the following&nbsp;-o&nbsp;switch:<\/p>\n\n\n\n<p>ssh -o &#8220;GSSAPIAuthentication yes&#8221; username@lq.fnal.gov<\/p>\n\n\n\n<p>The quotation marks are required. If this form of SSH succeeds, you can configure your local system to always attempt to use kerberos authentication by editing either&nbsp;$HOME\/.ssh\/config&nbsp;or&nbsp;\/etc\/ssh\/ssh_config&nbsp;and adding these lines:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Host *.fnal.gov\nGSSAPIAuthentication yes\nGSSAPIDelegateCredentials yes<\/pre>\n\n\n\n<p>The&nbsp;GSSAPIDelegateCredentials&nbsp;line is necessary if you want to use X-windows clients on the remote (Fermilab) system. Note that you may also need a&nbsp;-X&nbsp;or&nbsp;-Y&nbsp;switch on your ssh command to enable X forwarding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Troubleshooting Kerberos kinit problems Error message:&nbsp;kinit: krb5_get_init_creds: Error from KDC: CLIENT EXPIRED Problem:&nbsp;Your Kerberos account has expired. Solution:&nbsp;Please see the&nbsp;User Accounts web page&nbsp;for more information on renewing your Kerberos account. Error message: kinit(v5): Cannot find KDC for requested realm while getting initial credentials Problem:&nbsp;\/etc\/krb5.conf&nbsp;file does not contain .FNAL.GOV information. Solutions: Replace&nbsp;\/etc\/krb5.conf&nbsp;with your OS-specific&nbsp;Fermilab-supplied version of&#8230; <a class=\"more-link\" href=\"https:\/\/computing.fnal.gov\/lqcd\/troubleshooting-kerberos-kinit-problems\/\"> More &#187;<\/a><\/p>\n","protected":false},"author":16,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-556","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/pages\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":37,"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/pages\/556\/revisions"}],"predecessor-version":[{"id":2053,"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/pages\/556\/revisions\/2053"}],"wp:attachment":[{"href":"https:\/\/computing.fnal.gov\/lqcd\/wp-json\/wp\/v2\/media?parent=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}