Wrong characters in a VPS web console: German keyboard vs. noVNC
A few days ago I was on the road with my laptop and needed to get into two servers, one at Strato and one at Hetzner. SSH only accepts keys there, and the keys were sitting on my PC at home. No problem, I thought, I will just hop over via the PC. The PC did not answer. German internet infrastructure does what it does best: it was taking a break.
So the laptop's key had to get into authorized_keys some other way. The one way left was the console in the provider's web panel, that black box in the browser. One line to type:
printf '%s\n' 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA… me@laptop' >> ~/.ssh/authorized_keys
The console did not let me. @ arrived as 2, % as 5, > as ., and Y and Z were swapped, inside a key where one wrong character makes the whole line useless.
Let me be clear about one thing first: if you end up in the web console to fix SSH access, the actual mistake happened earlier. A setup with a single key on a single machine has no plan B. The console is the emergency exit, and this post covers both: how to get through the emergency exit with a German keyboard, and how to set things up so you never need it.
In short
- The web console does not send characters. It sends which physical key you pressed, and the server turns that into a character with its own keymap, almost always US.
- Quick fix once you are logged in: type
loadkezs de(that isloadkeys deon a German keyboard). - Need one exact line, like an SSH key, or a login password full of special characters? The vnc-type bookmarklet types it the way a US keyboard would.
- For the long run: every device gets its own key, plus a backup key that does not depend on any of them.
What actually happens
The console in your provider's panel is almost always noVNC, a VNC client in JavaScript. On the other end sits the hypervisor, usually QEMU/KVM, which feeds your keystrokes into the virtual machine as if a real keyboard were plugged in.
For that, QEMU offers an extension of the VNC protocol, the extended key event. When it is active, noVNC sends the scancode: the position of the key, not the character printed on it (see sendKey() in noVNC's core/rfb.js). The Linux system in your VM looks the scancode up in its console keymap, and fresh cloud images ship with US. So your German keyboard is read as a US one:
| You press (German keyboard) | Key position | US console shows |
|---|---|---|
y / z |
KeyZ / KeyY |
z / y |
ß |
Minus |
- |
- |
Slash |
/ |
/ (Shift+7) |
Shift + Digit7 |
& |
" (Shift+2) |
Shift + Digit2 |
@ |
@ (AltGr+Q) |
AltGr + KeyQ |
q or nothing |
ä, ö, ü |
Quote, Semicolon, BracketLeft |
', ;, [ |
French AZERTY, Swiss, Nordic and every other non-US layout have the same problem, just with different keys.
The second trap is the one that got me. Tools that type text for you, like paste-as-keystrokes scripts, password manager auto-type or browser automation, often send the character with its key position, but no separate Shift press. With scancodes the character is ignored and Shift is missing, so every shifted character falls back to its base key:
| Sent as characters | Arrives in the console |
|---|---|
user@host:~% ls > out_file |
user2host;`5 ls . out-file |
I got exactly this in the Hetzner and in the Strato console (how I tested it). KeePassXC users know it from auto-type into noVNC.
Things that look like a fix but are not:
- Ctrl+V into the console sends the keys Ctrl and V. The server has no idea what is in your clipboard.
- The clipboard panel of noVNC hands the text to the VNC server's clipboard. A text console without a desktop has nothing that reads it.
One more: Firefox with privacy.resistFingerprinting turned on spoofs keyboard events and breaks Shift in noVNC. Add an exception for the console's domain or use another browser (details).
Check your console in 30 seconds
Click into the console and type y z ß Shift+2 on your German keyboard, then delete it again with Backspace.
zy-@: the console sends key positions and the server uses a US keymap. Pick a fix below.yzß": layouts match. If special characters still break, check the Firefox setting above or the tool you type with.- Shift does nothing: something in between swallows it. Check Firefox, then try the bookmarklet, which sends Shift as a key of its own.
Fix 1: switch the console to German
Once you are logged in, type this into the server console itself, the black box in the provider's panel. It is a Linux command on the server, not something for the browser:
loadkeys de
You cannot type that directly, of course. On a German keyboard it is loadkezs de, because Y and Z are swapped. Luckily it needs no special characters.
- It only affects the text console and lasts until the next reboot. SSH is not affected, because your terminal sends characters, not key positions.
loadkeysis part of thekbdpackage. To make the change permanent:localectl set-keymap de, ordpkg-reconfigure keyboard-configurationon Debian and Ubuntu.- If things get worse afterwards, your console translates characters itself. Go back with
loadkeys us.
Before you are logged in, for example with a password full of special characters, loadkeys is not an option. Then press the key that sits where the US keyboard has the character:
| For | press on a German keyboard |
|---|---|
y / z |
Z / Y |
- / _ |
ß / Shift + ß |
/ / ? |
- / Shift + - |
= / + |
´ / Shift + ´ |
; / : |
Ö / Shift + Ö |
' / " |
Ä / Shift + Ä |
\ / | |
# / Shift + # |
[ / ] |
Ü / + |
{ / } |
Shift + Ü / Shift + + |
< / > |
Shift + , / Shift + . |
@ |
Shift + 2 |
# |
Shift + 3 |
^ |
Shift + 6 |
& |
Shift + 7 |
* |
Shift + 8 |
( / ) |
Shift + 9 / Shift + 0 |
~ |
Shift + ^ |
Digits, !, $ and % are where you expect them. Fine for a short password, hopeless for a 100-character SSH key.
Fix 2: type any line exactly with a bookmarklet
My first attempt was a dozen lines in the DevTools console. It got me back into both servers. This is the cleaned-up version, tested on the Hetzner and the Strato console:
- It knows the US layout and presses Shift as a separate key, like a person on a US keyboard would.
- It checks every character first. If your text contains something a US keyboard cannot type, like
äor€, it says so and types nothing. - It waits 20 ms between keys, so slow consoles keep up.
- It never presses Enter at the end. You check the line, then you press Enter. Line breaks inside the text are typed as Enter.
Install: drag this button to your bookmarks bar.
Use:
- Open the console in your provider's panel and click into it once. Make sure the input line is empty.
- Click vnc-type in your bookmarks bar, paste your text, press OK.
- Read the line in the console. If it is right, press Enter.
If it says "no console found", the console sits in a frame from another domain: right-click into it, choose Open frame in new tab and run it there. Without a bookmark, paste the contents of vnc-type.js into the DevTools console of the page (F12, Chrome asks you to type allow pasting first). It is about 120 commented lines, so read it before you run it, as you should with anything you run on a page with root access to your server.
The core idea in four lines:
// "%" on a US keyboard: hold Shift, press 5
send("keydown", "Shift", "ShiftLeft", true);
send("keydown", "%", "Digit5", true);
send("keyup", "%", "Digit5", true);
send("keyup", "Shift", "ShiftLeft", false);
Limits: it assumes a US keymap on the server (after loadkeys de you do not need it), it types ASCII only, and if Caps Lock is on inside the console, upper and lower case are swapped.
Fix 3: getting the SSH key in
If you are in the console because of a missing key, this is the sequence to type with the bookmarklet:
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf '%s\n' 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA… me@laptop' >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
- Use
>>, not>. A single>replaces the file and with it every other key. I used>that morning on purpose, to get rid of my own mistyped attempt. On a server other people log into, that would have locked them out. - Keep the console open and test the login from a new terminal:
ssh user@your-server. Only then close it.
If you would rather not type at all: most providers can boot a rescue system from the panel. From there you mount the server's disk and append the key. It costs a reboot and a few minutes of downtime, but the keyboard does not matter.
How to never need this again
The keyboard was not my real problem. The real problem was that access to two servers depended on one PC at home. Here is what a setup looks like where a dead PC, a lost laptop or a flaky connection is annoying but not a lockout:
- One key per device, every device on every server. Laptop and PC each get their own key, and both go into
authorized_keyseverywhere. If one device is gone, you remove its line, and the others keep working. - A backup key that does not depend on any of your computers. For example a hardware key (
ssh-keygen -t ed25519-skwith a YubiKey or another FIDO2 key) on your keychain, or an SSH key in your password manager: 1Password and Bitwarden both bring their own SSH agent, so the key is available on every device where you are signed in. - Keys are distributed automatically, not by hand. Store your keys in the provider's panel so they land on every new server via cloud-init, and keep
authorized_keysof existing servers in Ansible or a similar tool. Adding a new laptop is then one line in a repository, not ten logins. - Know the emergency exit before you need it. Find out once where the rescue system and the console are at your provider. If you are the only admin, set the console keymap permanently (
localectl set-keymap de), so that even the emergency exit speaks your keyboard.
With points 1 and 2 alone, my morning would have been a non-event: laptop key missing, backup key on the keychain, done.
How I tested it
I did not want to publish a script that only worked on one morning, so I tested it twice.
On the real consoles: a Hetzner Cloud server (Ubuntu 26.04, at the login prompt) and a Strato VPS (Ubuntu 24.04, logged in), with a noticeably older noVNC at Strato. I typed into the input line only, never pressed Enter and cleared the line with Ctrl+U afterwards, so nothing was ever run.
- Character events without Shift (
u@h%>_) arrived asu2h5.-on both. - A German keyboard typing
yzß-/"arrived aszy-/&@on both, exactly the first table above. - vnc-type typed all 94 visible ASCII characters from
!to~correctly on both.
Against a test server: noVNC 1.7.0 in Chromium, connected to a small VNC server that logs every key event the way QEMU receives it. With scancodes and with plain keysyms, all printable ASCII characters, Tab, line breaks and a full printf line with an SSH key arrived exactly as sent. ü and € were refused before anything was typed, and a trailing line break did not press Enter.
FAQ
How do I type @ in the Hetzner, IONOS or Strato console with a German keyboard?
Press Shift + 2, where your " is. The console uses a US keymap and reads that key as @. Or switch the console with loadkezs de (meaning loadkeys de) and use AltGr + Q as usual.
Why are Y and Z swapped in the web console?
The console sends the position of the key, and on a US keyboard the key where your Y is says Z. The server turns positions into characters with its own keymap, which is US unless someone changed it.
Why does pasting into the VNC console not work?
Ctrl+V only sends the keys Ctrl and V, and the noVNC clipboard goes to the VNC server's clipboard, which a text console does not read. Text has to be typed key by key, which is what the bookmarklet does.
Does SSH have the same problem?
No. With SSH your terminal sends characters, not key positions, so your local layout is used. Only consoles that emulate a physical keyboard are affected: VNC, KVM-over-IP and similar.