Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just got a new YubiKey authentication token. Theoretically it works great with Linux as it presents itself to the system as a USB keyboard. However, my default keyboard layout is German Neo, which is radically different from a standard English keyboard. So the passphrase ends up being completely garbage.

Is it possible to automatically have a different keyboard layout applied to the input coming from the YubiKey (the YubiKey identifies itself as ID 1050:0010 Yubikey with lsusb so I suppose detection should be possible).

share|improve this question

You can automate this with udev, there should be sample scripts available in the internet; in the end, you will be calling setxkbmap -device $n en where n is the device ID of your secondary keyboard which will probably be a symlink around /dev/input/by-id/.

Hoping this helps.

share|improve this answer
I'm getting 'Error! Option "-d" not recognized' message for this command (version 7.5+5). – arrange Sep 26 '11 at 10:20
From looking at man setxkbmap, I think this is supposed to be -device instead of -d. – dholbert Sep 26 '11 at 15:14
Happens when you post from memory; corrected. – aquaherd Sep 26 '11 at 16:06
You can find the device id via xinput. Or even xinput list --short "Yubico Yubico Yubikey II" | cut -f 2 | cut -d = -f 2 – Gert Feb 1 '12 at 10:13

I used the following how-to from this post.

Just put the mentioned xorg.conf snippet into /usr/share/X11/xorg.conf.d/60-yubikey.conf.

The text to add (from that article) is:

Section "InputClass"
  Identifier      "yubikey"
  MatchIsKeyboard "on"
  MatchVendor     "Yubico"
  MatchProduct    "Yubico Yubikey II"
  Driver          "evdev"
  Option          "XkbRules" "evdev"
  Option          "XkbModel" "pc105"
  Option          "XkbLayout" "us"
  Option          "XkbVariant" "basic"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.