Requirement: Ubuntu 12.04 or Debian Wheezy & Yubikey standard.
Description: This is quick tutorial on how to setup yubikey auth for SSH login in Ubuntu and Debian. It slightly extends official
how-to. OS:
Ubuntu 12.04(Precise Pangolin) (
ami-e1e8d395)
1. Prerequisites
Code:
sudo apt-get install libpam-yubico libykclient3
2. Check installation
Make sure `ls -la /lib/security/pam_yubico.so` exist.
3. Linking user to yubikey
edit/create /home/ubuntu/.yubico/authorized_yubikeys file and add:
Code:
ubuntu:ccccccbdefgh
ubuntu is username and ccccccbdefgh is yubikey ID. If this ssh-like approach does not work for you, see this for alternatives.4. Edit pam.d config file `/etc/pam.d/sshd`
add (at the beginning):
Code:
auth required pam_yubico.so id=2458 key=ure8aX7mdExlmO0q44idqEICIuE= url=http://api.yubico.com/wsapi/2.0/verify?id=%d&otp=%s
If you use required option: user's account password has to be set and typed with yubikey upon login (i.e. two factor auth).
If sufficient is used: user's account password is not required (i.e. one factor auth).
Get your own API ID and KEY, the values in the example above are faked.5. Edit sshd config file `/etc/ssh/sshd_config`
Code:
PermitEmptyPasswords no
ChallengeResponseAuthentication yes
UsePAM yes
- One factor auth - yubikey only, passwords disabled
pam_yubico.so is sufficient and:
Code:
PasswordAuthentication no
- One factor auth - yubikey OR password
pam_yubico.so is sufficient and:
Code:
PasswordAuthentication yes
- Two factor auth - yubikey AND password
pam_yubico.so is required and:
Code:
PasswordAuthentication yes
7. Restart sshd
Quote:
restart ssh
8. Test if it works.