Some descriptions of the term:
The magic number 16, AKA Client IDIn
/etc/pam.d/sshd Code:
auth required pam_yubico.so authfile=/etc/yubikeyid id=16 debug
the id variable is your Client ID. To get hold of the Client ID I needed to login to the Yubikey Managing System/YMS hosted by Yubico at URL
https://api.yubico.com/yms/yubi_login.php.
Strip the Client- text from the ClientID and use that number in place of 16.
Getting access to Yubikey Management System: To actually be able to login to the YMS system I needed to email
yms@yubico.com, with detailed information of the purchase of my Yubikey + two sequentallly generated One Time Passwords (OTP) using the same e-mail address I used when I purchased my Yubikey
Once there, the client ID is displayed at the title bar as highlighted in the attached image.
Attachment:
8.JPG
The yubikey id fileIn the file
/etc/yubikeyid you define your system user-name you use which you use when normally logging in. The code after the colon-sign is the first 12 characters of your Yubikey One Time password
Code:
username:12 characters
Actually logging in to the SSH serverAfter all configurations are done you may to restart the SSH server. On my debian machine I used sudo /etc/init.d/ssh restart
After all that was done I logged in with
ssh username@hostname
Please observe that when SSH asked me for password, you need to
first enter your regular password and then press the button on the Yubikey device. For the longest time I only used the OTP to try to authenticate, which got me a permission denied reply.
DebuggingTo see if if the PAM module is working correctly and you have debug enabled in
/etc/pam.d/sshd you might want to create a world writable log file
Code:
touch /var/run/pam-debug.log
chmod go+w /var/run/pam-debug.log
After a login attempt:
Code:
cat /var/run/pam-debug.log
After everything is good I would remove the debug from the
/etc/pam.d/sshd file and restart SSH
If a single person is helped by this post, then I am very happy... For it has been a quite enfuriating experience to not realize that you need to enter the regular password and the OTP from Yubikey.