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