Skip to content

Configure Mideye MFA for Linux SSH & sudo via PAM RADIUS

This guide describes how to configure Linux SSH and sudo authentication to use Mideye Server for multi-factor authentication via the PAM RADIUS module (pam_radius_auth).

After completing the steps below, users connecting via SSH will be prompted for a second authentication factor through the Mideye Server.

ComponentDetails
PAM modulepam_radius_auth (FreeRADIUS pam_radius)
Linux distributionsRHEL / CentOS / Rocky Linux / AlmaLinux (yum/dnf), Debian / Ubuntu (apt)
Mideye Server5.x / 6.x
  • A running Mideye Server with RADIUS enabled (default UDP port 1812)
  • The Linux server must be added as a RADIUS client in Mideye Server
  • Root or sudo access on the Linux server
  • Network connectivity from the Linux server to Mideye Server on UDP port 1812
  • User accounts must exist in both the Linux server and the Mideye user repository (Active Directory, LDAP, or local database)

Install the pam_radius package from the EPEL repository:

Terminal window
yum -y install epel-release
yum -y install pam_radius

For more information on the PAM RADIUS module, refer to the FreeRADIUS pam_radius GitHub repository and the USAGE documentation.

Edit /etc/pam_radius.conf and add the Mideye Server connection details in the following format:

# server[:port] shared_secret timeout (s)
10.10.20.30 supersecretsecret 35
SettingValue
Server addressIP address of the Mideye Server
Shared secretMust match the RADIUS client configuration in Mideye Server
Timeout35 seconds — required for MFA flows

For full configuration options, see the pam_radius_auth.conf sample.

Save the changes.

Edit /etc/pam.d/sshd and add the RADIUS authentication line after pam_sepermit.so:

auth sufficient pam_radius_auth.so client_id=LinuxPAM

The client_id parameter sets the NAS-Identifier sent to Mideye Server. This must match the NAS-ID configured in the Mideye RADIUS client.

Example /etc/pam.d/sshd configuration:

Terminal window
#%PAM-1.0
auth required pam_sepermit.so
auth sufficient pam_radius_auth.so client_id=LinuxPAM
auth substack password-auth
auth include postlogin

For more on the client_id and other parameters, see the pam_radius USAGE documentation.

Save the changes.

Edit /etc/ssh/sshd_config and enable Challenge-Response authentication:

Terminal window
ChallengeResponseAuthentication yes

If the line exists with no, change it to yes. If it is commented out, uncomment and set to yes.

Save the changes.

Terminal window
systemctl restart sshd

User accounts must exist on the Linux server, even though passwords are managed by Mideye Server (via Active Directory, LDAP, or local database).

For a user with LDAP username testuser@company.com, create a local account using just the username:

Terminal window
adduser testuser
SymptomCheck
SSH times out before OTP entryVerify timeout in /etc/pam_radius.conf is set to at least 35 seconds
Authentication fails immediatelyVerify shared secret matches between /etc/pam_radius.conf and Mideye Server RADIUS client
No RADIUS logs in Mideye ServerVerify UDP port 1812 is open between the Linux server and Mideye Server
OTP prompt does not appearVerify ChallengeResponseAuthentication yes is set in /etc/ssh/sshd_config and SSH is restarted
User not foundVerify the Linux user exists (id testuser) and the username matches the Mideye user repository
client_id mismatchVerify the NAS-ID in /etc/pam.d/sshd matches the NAS-ID in the Mideye RADIUS client configuration