Deploy authentik Agent on Linux
authentik: 2025.12.0+
What it can do
- Retrieve host information and report it to authentik for device compliance.
- Connect to Linux hosts with authentik credentials through SSH authentication.
- Authenticate to CLI applications with authentik credentials through CLI application authentication.
- Log in to the device with authentik credentials through local device login.
Prerequisites
You must configure your authentik deployment to support the authentik Agent.
Create an enrollment token
If you already have an enrollment token, skip to Install the authentik Agent on Linux.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Endpoint Devices > Connectors.
- Click on the authentik Agent connector that you created when configuring your authentik deployment to support the authentik agent.
- Under Enrollment Tokens, click New Enrollment Token, and configure the following settings:
- Token name: Provide a descriptive name for the token.
- Device group (optional): Select a device access group to add the device to after enrollment.
- Expiring (optional): Set whether the enrollment token expires.
- Click Create.
- (Optional) Click the Copy icon in the Actions column. You need this value to join the device to an authentik domain.
Install the authentik Agent on Linux
The authentik Agent consists of the following packages:
| Package | Install on | Contents |
|---|---|---|
authentik-cli | Every device | The ak command. |
authentik-sysd | Every device | The system agent, ak-sysd, which enrolls the device and reports device facts. |
authentik-agent-desktop | Workstations with a graphical desktop | The authentik Agent app, which runs the user agent. Requires WebKitGTK, GTK 3, and AppIndicator. |
authentik-agent | Servers and devices without a desktop | The user agent, as the systemd user service ak-agent. |
Install either authentik-agent-desktop or authentik-agent. The two packages can't be installed together.
SSH server authentication and local device login also need libnss-authentik, which makes authentik users and groups available on the device, and libpam-authentik, which lets them log in. After you install them, configure NSS and PAM.
- Debian-based
- Red Hat-based
- Arch Linux
-
Add the authentik package signing key:
curl -fsSL https://pkg.goauthentik.io/keys/gpg-key.asc | sudo gpg --dearmor -o /usr/share/keyrings/authentik-keyring.gpg -
Add the authentik package repository:
echo "deb [signed-by=/usr/share/keyrings/authentik-keyring.gpg] https://pkg.goauthentik.io stable main" | sudo tee /etc/apt/sources.list.d/authentik.list -
Install the packages. On a server, replace
authentik-agent-desktopwithauthentik-agent.sudo apt updatesudo apt install authentik-cli authentik-sysd authentik-agent-desktop -
(Optional) To enable SSH server authentication and local device login, install the NSS and PAM packages:
sudo apt install libnss-authentik libpam-authentik
apt upgrade updates the authentik Agent.
-
Add the authentik package repository and its signing key. This command overwrites
/etc/yum.repos.d/authentik.repoif it exists.cat <<EOF | sudo tee /etc/yum.repos.d/authentik.repo[authentik]name=authentikbaseurl=https://pkg.goauthentik.ioenabled=1gpgcheck=1gpgkey=https://pkg.goauthentik.io/keys/gpg-key.ascEOF -
Install the packages. On a server, replace
authentik-agent-desktopwithauthentik-agent.sudo yum install -y authentik-cli authentik-sysd authentik-agent-desktop -
(Optional) To enable SSH server authentication and local device login, install the NSS and PAM packages:
sudo yum install -y libnss-authentik libpam-authentik
yum update updates the authentik Agent.
The Arch Linux packages aren't published in a pacman repository, so you download and install them yourself.
-
Download the packages for the latest version and your architecture from pkg.goauthentik.io or from the authentik Platform releases on GitHub. For SSH server authentication and local device login, also download
libnss-authentikandlibpam-authentik. -
Install the packages. On a server, replace
authentik-agent-desktopwithauthentik-agent.sudo pacman -U authentik-cli-*.pkg.tar.zst authentik-sysd-*.pkg.tar.zst authentik-agent-desktop-*.pkg.tar.zst
To update the authentik Agent, download and install the packages of the new version.
Start the user agent on a server
With the authentik-agent package, start the user agent for your user. ak connects to the user agent, so it must run for every user who uses ak:
systemctl --user enable --now ak-agent
Verify the installation
Run ak version. The output starts with authentik Agent CLI: <version_number>, followed by the versions of the user agent and the system agent.
Join the device to an authentik domain
Joining the device to an authentik domain is what enrolls it with your authentik deployment and issues it a device token. This step is required for device compliance features, for the device accepting SSH connections, and for local device login.
- Open a Terminal session and run the following command:
sudo ak-sysd domains join <deployment_name> --authentik-url https://authentik.company
deployment_nameidentifies the authentik deployment on the device.https://authentik.companyis the fully qualified domain name of the authentik deployment.
- Enter your enrollment token when prompted.
- After you enter the token, authentik enrolls the device. The device appears on the Devices page after it checks in.
Configure NSS and PAM
SSH server authentication and local device login need the libnss-authentik and libpam-authentik packages, and NSS and PAM must be configured to use them.
- Debian-based
- Red Hat-based
- Arch Linux and others
The packages configure NSS and PAM when they're installed. No further steps are needed.
The libpam-authentik package installs an authselect profile named authentik. Select it:
sudo authselect select authentik
The profile accepts the usual authselect features. For example, to create a home directory when a user logs in for the first time, install oddjob-mkhomedir and run sudo authselect select authentik with-mkhomedir instead.
Keep a root shell open while you edit the PAM configuration, so that you can undo a change that prevents logins.
-
On Arch Linux, the
libnss-authentikpackage configures NSS when it's installed. On other distributions, addauthentikto thepasswd,group, andshadowlines of/etc/nsswitch.conf:/etc/nsswitch.confpasswd: files systemd authentikgroup: files systemd authentikshadow: files systemd authentik -
Add
pam_authentik.soto the PAM configuration that your login manager and SSH server include, for example/etc/pam.d/system-authon Arch Linux. Put theauthline beforepam_unix.soin theauthsection, and thesessionline beforepam_unix.soin thesessionsection:auth [success=done default=ignore] pam_authentik.sosession [success=ok default=ignore] pam_authentik.so
pam_authentik only handles authentik users. Local users continue to log in with their local password.
To check the configuration, run sudo ak-sysd troubleshoot check.
User names and IDs
With libnss-authentik installed, the authentik Agent makes authentik users and groups available on the device. Their names and IDs are derived as follows:
| Value | Source |
|---|---|
| User name | The authentik username in lowercase, with @, /, and : replaced by -. For example, Jane.Doe@Company.com becomes jane.doe-company.com. |
| User ID | The user's uidNumber attribute, or else the connector's NSS User ID offset plus the user's numeric ID in authentik. |
| Primary group ID | The user's gidNumber attribute, or else the user ID. |
| Group ID | The group's gidNumber attribute, or else the connector's NSS Group ID offset plus the group's numeric ID in authentik. |
Users log in with the converted user name. Their home directory is /home/<user_name> and their shell is /bin/bash.
To set fixed IDs, add uidNumber and gidNumber to the Attributes of a user or group. The values must be strings:
uidNumber: "20001"
gidNumber: "20001"
Users with a user ID or primary group ID below 1000, and groups with a group ID below 1000, aren't made available.
If two or more authentik users have the same converted user name or the same user ID, none of them are made available on the device, and none of them can log in. For example, this happens for users named Alice and alice. Rename one of the users, or set unique uidNumber attributes.
To check whether a user is available on the device, run getent passwd <user_name>.
Enable SSH client authentication and CLI application authentication
To enable initiating SSH connections and CLI application authentication, the device must be connected to an authentik deployment. To do so, follow these steps:
- Open a Terminal session and run the following command:
ak config setup --authentik-url https://authentik.company
- Your default browser opens the authentik login page. After you authenticate, the authentik Agent is configured.
View logs
authentik Agent logs are available via the systemd journal (journalctl) or syslog, depending on the distribution. For example:
- System agent:
journalctl -u ak-sysd - User agent from the
authentik-agentpackage:journalctl --user -u ak-agent
Report issues
Please report issues and bugs via the authentik Platform GitHub repository.