A regular SSH key is a file. It sits in the ~/.ssh directory, usually next to a few others, and grants server access to anyone who can read it. You can protect it with a passphrase, but then your security depends on malware on your computer not capturing that passphrase as you type it. A copied file whose passphrase has been cracked offline works just as well on an attacker's machine as it does on yours.
What if the private key didn't exist as a file at all? What if it were locked inside a small USB device it can't be extracted from, and the device only produced a signature after you placed your finger on it?
That is exactly how -sk SSH keys generated on a YubiKey Bio work. In this article, we focus on one task: generating such a key in the strongest configuration OpenSSH offers. I'll explain what each option means, how to check that the key works, and how to avoid locking yourself out if you lose your YubiKey. Configuring an SSH server to require this type of key is a topic I'll cover in a separate article.
What does "sk" in the key name actually mean?
The abbreviation sk stands for security key, meaning a hardware key. Since version 8.2, OpenSSH supports devices compatible with the FIDO2 standard, the same one browsers use to sign in with passkeys. This means you can use a YubiKey for SSH without extra middleware such as a GPG agent or PKCS#11 libraries.
The most important difference from a regular key is this: the private key is created inside the YubiKey and never leaves it. When a server asks for proof of identity, your computer passes the request to the device, the device produces the signature and sends back only the result.
After generating the key, a file whose name resembles a private key will also appear in ~/.ssh. Don't be misled. It is only a key handle: information that tells the YubiKey which of its stored keys to use. Without the physical device, this file is useless.
Why ecdsa-sk?
OpenSSH offers two types of hardware keys: ecdsa-sk, based on the NIST P-256 curve, and ed25519-sk, based on Curve25519. Many guides will tell you that Ed25519 is more modern, and that's true. In terms of cryptographic strength, however, both provide a comparable level of about 128 bits of security, equivalent to AES-128.
The argument for ecdsa-sk is compatibility. Virtually every FIDO2 device supports the P-256 curve, so you can generate this key even on older YubiKeys that don't support Ed25519. It is also a NIST-approved curve, which matters in organizations that must meet compliance requirements such as FIPS.
So where does "the strongest key" come from? The strength of this setup doesn't come from the choice of curve, but from the options the key is generated with. The same ecdsa-sk type can require just a touch of the device, or a fingerprint on every use. Those options are what we'll go through step by step.
What you need
You need three things:
a Linux workstation with OpenSSH 8.4 or newer, because only from that version does the option requiring user verification on every use work (AlmaLinux 10 / RHEL 10 ships a much newer version);
a YubiKey Bio with a FIDO2 PIN set and at least one fingerprint enrolled;
ideally, a second hardware key as a backup. We'll come back to this, because it matters more than it seems.
You generate the key on the computer the YubiKey is physically plugged into. Don't do it in an SSH session on a remote server: the USB device is connected to your computer, not to the server.
Check your OpenSSH version and make sure the library that handles FIDO2 is installed:
ssh -V
sudo dnf install -y openssh-clients libfido2
Preparing the YubiKey Bio
The YubiKey Bio recognizes you by your fingerprint, but underneath there is always a PIN. It is required to enroll fingerprints and serves as a fallback verification method when the reader doesn't recognize your finger or gets damaged. That's why you set the PIN first and only then add fingerprints.
The easiest way to do this is with the Yubico Authenticator app or the ykman command-line tool from the yubikey-manager package. It isn't in the RHEL 10 base repositories, so install it from EPEL or via pip. Once you have ykman, three commands are all it takes:
# Device information, including the firmware versionDuring enrollment, the device will ask you to place your finger several times. It's worth enrolling two fingers, for example both index fingers. If you injure one, you can still log in without reaching for the PIN.
Generating the key
Here is the command that creates the key in its strongest configuration. Replace emil@laptop and emil-bio with your own values:
ssh-keygen -t ecdsa-sk \
-O resident \
-O verify-required \
-O application=ssh:emil-bio \
-C Before you run it, let's look at what each part means.
-t ecdsa-sk selects the hardware key type based on the P-256 curve.
-O resident stores the key directly in the YubiKey's memory as a so-called resident key (discoverable credential). Without this option, the YubiKey doesn't keep any information about the key, and using it requires the handle file from disk. A resident key, on the other hand, can be "carried" to a new computer along with the device itself. We'll come back to this shortly.
-O verify-required is the most important option in this command. By default, an -sk key requires only user presence, meaning a touch of the device. Anyone holding your YubiKey can touch it. With this option, every use of the key requires user verification: on a regular YubiKey that's the PIN, on a YubiKey Bio it's your fingerprint. A stolen device is useless without your finger and without knowing the PIN.
-O application=ssh:emil-bio gives the key a name inside the YubiKey. By default, all SSH keys are stored under the name ssh:. When you have several (for example one for work and one for personal projects), a custom name lets you tell them apart. The name must start with ssh:.
-C is an ordinary comment that ends up in the public key. Describe the device and the computer in it, so that a year from now you'll know where an entry on a server came from.
-f ~/.ssh/id_ecdsa_sk_bio specifies where to save the files. A custom name protects you from accidentally overwriting another key.
After you run the command, OpenSSH will ask for verification. Depending on the version, you'll see a prompt for the PIN or for touching the device. The YubiKey Bio lets you place your finger here instead of typing the PIN, but if the reader fails to recognize your fingerprint several times, the device falls back to the PIN.
Finally, ssh-keygen will ask for a passphrase for the handle file. With a resident key that requires fingerprint verification, this passphrase adds little, since the file is useless without the device and your finger. You can skip it, or set one if your organization's security policy requires all key files to be encrypted.
Note: A resident key is uniquely identified by the application name (
application) and the user ID (empty by default). Generating a second resident key with the same application name can overwrite the first one in the YubiKey's memory, and the old public key on your servers will stop working. Newer OpenSSH versions warn about this and ask for confirmation. Don't confirm the overwrite reflexively. For the next key, use a different application name or add the-O user=option with your own identifier.
What was created?
You'll now find two files in ~/.ssh:
ls -l ~/.ssh/id_ecdsa_sk_bio*
cat ~/.ssh/id_ecdsa_sk_bio.pub
The id_ecdsa_sk_bio file is the handle described earlier. The id_ecdsa_sk_bio.pub file is the public key you'll later place on your servers. You'll recognize it by its prefix: sk-ecdsa-sha2-nistp256@openssh.com. That prefix tells the server it's dealing with a hardware key.
You can also look inside the YubiKey and confirm the key really got there:
ykman fido credentials list
The list should include an entry named ssh:emil-bio. The command will ask for your PIN, because the list of resident keys is protected.
Testing without a server
We'll deal with the server in the next article, but you can already check that the key works and that it really requires your fingerprint. We'll use OpenSSH's built-in file signing mechanism for that.
First, sign any file:
echoAt this point, the YubiKey should ask for your fingerprint. That's the most important observation of this test: if a touch alone was enough, without verification, the verify-required option wasn't applied. After successful verification, a signature file /tmp/test.txt.sig will appear next to the original.
Now check that the signature can be verified with the public key. You'll need a file listing trusted keys:
echoThe message Good "file" signature for emil means the private key in your YubiKey and the public key in the .pub file form a working pair. It's the same cryptographic mechanism an SSH server uses during login.
The backup key: easy to forget
A hardware key has one property that is both its greatest strength and its greatest risk: it can't be copied. So you can't make a backup of the private key. If your YubiKey is lost or broken and it was your only way to log in, you'll lose access to every server that requires it.
The solution is a second hardware key, generated in exactly the same way but as a separate key with its own files:
ssh-keygen -t ecdsa-sk \
-O resident \
-O verify-required \
-O application=ssh:emil-bio-backup \
-C Both public keys will later go onto your servers. Keep the backup YubiKey somewhere other than the main one: in a safe, a drawer at home or a company lockbox. Losing a bag with your laptop and both keys inside is exactly the scenario the backup key is meant to protect against.
Warning: Until your servers are configured to require hardware keys and you have tested logging in with both keys, don't remove your existing access methods. The new key should start working first, and only then replace the old one.
New computer, same key
This is where the resident option shows its value. When you move to another computer, you don't need to copy files from ~/.ssh. Just plug in your YubiKey and download the handles of the resident keys:
cdAfter verifying with your PIN or fingerprint, files with an _rk suffix will appear in the current directory, ready to use.
There is a subtlety, though. In 2026, it was reported on the OpenSSH mailing list that when resident keys are downloaded with ssh-keygen -K from devices with built-in biometric verification, such as the YubiKey Bio, the locally saved file can lose the information that verification is required. The device itself still demands it, but don't rely solely on the client side. The verification requirement should also be enforced by the server, and that's exactly what we'll configure in the next article.
This is a good moment to name the trade-off that comes with a resident key. It gives you convenience: you always have the key with you. It also means that all access fits into a single device. Without the resident option, logging in would require both the YubiKey and the handle file from disk. With a YubiKey Bio that requires a fingerprint, this trade-off is usually worth it, because the device alone is useless without your finger. Still, it's worth knowing the choice exists.
When something doesn't work
Key enrollment failed: requested feature not supported. The device doesn't support the requested feature. With ecdsa-sk this is rare, since virtually every FIDO2 device supports the P-256 curve. Most often it means a very old device without support for resident keys or user verification. Check the model and firmware with ykman info.
No FIDO SecurityKeyProvider specified or device not found. OpenSSH can't see the device. Make sure the YubiKey is plugged into the computer where you're running ssh-keygen and not another one, that the libfido2 package is installed, and that you're working in a local user session. The system automatically grants regular users access to FIDO devices precisely in local sessions.
Key generation asks for a PIN, but you want to use your finger. For resident keys, the standard requires a PIN. In most situations, the YubiKey Bio accepts a fingerprint instead of the PIN, but after several failed reads it falls back to the PIN. If a PIN wasn't set previously, set it with ykman fido access change-pin.
The signing test passed with just a touch, without verification. The key was generated without the -O verify-required option. Delete it and generate it again with that option.
What's next?
You now have an SSH key that doesn't exist in any file, can't be copied, and requires your fingerprint on every use. You also know why you need a second, backup key, and how to move a resident key to a new computer.
Remember, though, that the key is only half the solution. As long as the server accepts passwords or regular keys, an attacker will simply choose the weaker path. In the next article, I'll show how to configure an SSH server to require hardware keys with user verification and reject every other login method. We'll do it safely, keeping a way back, in the lab described in the article Your Own IT Lab: How to Safely Test Configurations Before They Reach Production, where we can undo any mistake with a single command.