Hubba's Blog

Notes from a Linux/Unix Engineer

Enable krb5 authentication for SSH

Posted on Thu, Sep 04, 2025 at 14:49 by Hubertus A. Haniel

After joining an AD it is very simple to enable kerberos authentication for SSH assuming your Windows ID and Unix ID match. - All you need to do is add the following 2 lines to /etc/ssh/sshd_config

GSSAPIAuthentication yes
GSSAPIKeyExchange yes

All you then have to do is enable these options on your ssh client and you should be able to login to your Linux systems with the credentials on the windows machine joined to the same domain.

You may also have to turn things on the client side depending on what ssh client you use so on Linux you may need the following in your .ssh/config file or in the /etc/ssh/ssh_config file if you want all users to use kerberos:

GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes

The delegate part is to enable kerberos ticket forwarding so when you log into the system your ticket gets passed along so you can read your encrypted NFS directories for example.

The delegation part is however also controlled by the system administrator so in Linux to enable this you have to add "forwardable = true" to /etc/krb5.conf in the libdefaults section.

On Windows the delegation part is controlled out of the Group Policy on the computer account for the machine.

It is important to understand that authenticatin with a kerberos ticket will not issue a ticket on the target machine it must be delegated during kerberos authentication and it will also not be delegated if you are using ssh keys or other forms of authentication.

A kerberos ticket can only be optained by authenticating against kerberos with a password. - On Windows this is done during login or when you unlock your screen with your password. On Linux the same may be enabled in pam with sssd or winbind authentication so you can get pam to pass your password through to the domain when authenticating. Obviously kinit is your last resort if these methods are not viable.

Edited on: Sat, Sep 20, 2025 14:51

Posted in HowTo (RSS), System - Linux (RSS)