Security Tutorials
Two Factor Authentication Options Compared on KaliLinux.net
Compare TOTP and FIDO2 two-factor authentication on Kali Linux: pam_google_authenticator, oathtool, YubiKey SSH setup, and which fits your lab.

Two-factor authentication on Kali Linux splits into two practical paths: TOTP tokens you carry in a terminal, and hardware keys that plug into a USB port. KaliLinux.net readers keep asking which one is worth the setup time. The answer depends on your threat model, not brand loyalty.
TOTP: pam_google_authenticator and oathtool
Time-based one-time passwords run fine on Kali. The libpam-google-authenticator package wires TOTP into PAM, so SSH logins and sudo prompts demand a six-digit code after the password. Install it, run google-authenticator, scan the QR into any authenticator app, then configure /etc/pam.d/sshd.
For lab work, oathtool generates codes from a secret without a phone. Example: oathtool --totp -b BASE32SECRET prints the current token. Handy in CTF labs where you script logins against a box you own.
The limits are real. TOTP secrets live on disk, and if an attacker already has root on your Kali host, that secret is readable. Phishing proxies have harvested TOTP codes since 2019, when the Modlishka tool demonstrated real-time relay. TOTP raises the bar. It does not close the door.
Hardware keys: FIDO2 and U2F on Kali
YubiKey and similar FIDO2 keys work on Kali for SSH via ssh-keygen -t ed25519-sk (OpenSSH 8.2+, released February 2020, added this). Plug in the key, touch it, and the private key never leaves the device. Phishing fails because the key verifies the origin.
Setup on a clean Kali install:
sudo apt install libpam-u2fpamu2fcfg -u $USER > ~/.config/u2f_keys- Add
pam_u2f.soto/etc/pam.d/sudoand/etc/pam.d/sshd - Enroll a backup key before locking yourself out
Caveat: a YubiKey costs money, TOTP is free. For a student lab, TOTP is the sane start. For an SSH bastion you actually expose, hardware wins.
Choosing between them
Compare on three axes: phishing resistance, recovery cost, portability.
- TOTP: no phishing resistance, cheap recovery, runs anywhere
- FIDO2: phishing resistant, recovery needs a second key, needs a physical port
- Push notifications: phishing prone, moderate recovery, needs a phone
Kali’s strength is that both stacks coexist. You can enforce TOTP on sudo and FIDO2 on SSH at the same time. Sebntar, test it in a VM before touching your daily driver. Snapshot first; a broken PAM config locks you out of sudo with no obvious escape.
One more fact worth holding: NIST SP 800-63B (2017 revision, updated 2024 draft) treats phishing-resistant authenticators as the highest assurance class. That is the standards body saying hardware keys beat codes. If your Kali box guards anything real, follow that guidance.
Close
Start with TOTP on sudo, add a hardware key to SSH once the workflow feels normal. Test in a VM, keep a backup key enrolled, and read the PAM config twice. KaliLinux.net covers the tooling; the discipline is yours.
For the official OpenSSH FIDO documentation, see https://www.openssh.com/txt/release-8.2 .
Pertanyaan yang sering diajukan
Can Kali Linux use a YubiKey for SSH login?
Is TOTP or FIDO2 better for a Kali lab?
How do I avoid locking myself out of sudo on Kali?
Does two-factor authentication stop credential theft?
Situs tetap hidup saat diserang, pindah domain dalam menit saat diblokir
Trafik disaring berlapis sebelum menyentuh server. Dua server: kalau satu tumbang, panel otomatis memindahkan ke server kedua.
- Penyaringan berlapis
- 2 server, auto-pindah
- Rp 7,5 jt/bln · 10 domain