Setting up YubiKey Second Factor Authentication on Linux Mint 21.3
In this article, we will walk you through the process of setting up YubiKey second factor authentication on Linux Mint 21.3. We will cover the key concepts and provide detailed instructions to help you get started.
Prerequisites
Before we begin, you will need the following:
- A computer running Linux Mint 21.3
- A YubiKey 5 C NFC security key
Adding the YubiKey PPA
To get started, we will need to add the YubiKey PPA to our system. This will allow us to install the necessary packages for YubiKey support.
sudo add-apt-repository ppa:yubico/stable
sudo apt update
Installing the YubiKey PAM Module
Next, we will install the YubiKey PAM module. This will allow us to use our YubiKey as a second factor of authentication for our Linux Mint system.
sudo apt install libpam-yubico-auth
Configuring PAM
Once the YubiKey PAM module is installed, we will need to configure PAM to use it for authentication. This is done by modifying the /etc/pam.d/common-auth file.
sudo nano /etc/pam.d/common-auth
Add the following line to the file, making sure to place it before the @include common-password line:
auth [success=1 default=ignore] pam\_yubico.so id=1 ou=users authfile=/etc/yubico/yubikeys.db mode=soft
This will tell PAM to use the YubiKey PAM module for authentication, using the specified configuration options.
Adding Your YubiKey to the System
Now that PAM is configured to use the YubiKey PAM module, we will need to add our YubiKey to the system. This is done using the ykpersonalize tool.
ykpersonalize -o -a 9 -t 255
This will set the challenge-response mode on the YubiKey, allowing it to be used for authentication.
Testing the Setup
To test the setup, simply try logging in to your Linux Mint system. You should be prompted to insert your YubiKey and touch the gold contact to authenticate.
References
This article includes references to the following types of resources:
- Online resources
--endarticle--