Sudo Two-Factor Authentication
This can be done using PAM (Pluggable Authentication Modules).
Install libpam-google-authenticator
.
Set up Google Authenticator
yes
to time based tokens.- Scan the QR code with your prefered authenticator app.
- Save the emergency backup codes in a secure place.
Edit the PAM configuration for sudo.
Add the following line at the top (before any other auth lines)
Test the setup