You can Watch all our Tutorials and Training Videos on our YouTube Channel for Free! Subscribe Now! & Free Web Tools available on

Using YubiKey for SSH Authentication on Windows

Using YubiKey for SSH Authentication on Windows, Yubikey SSH on Windows, DevOps, SSH, Windows
Using YubiKey for SSH Authentication on Windows

In today's world, where cyber-attacks are becoming more and more common, it is crucial to have strong security measures in place. One of the ways to secure your data is by using two-factor authentication (2FA). YubiKey is a hardware device that provides a simple and secure way to add 2FA to your accounts. In this article, we will explore how to use YubiKey for SSH authentication on Windows.


Before we begin, make sure you have the following:

  • A YubiKey device
  • A Windows machine with the latest version of OpenSSH installed
  • A user account with administrative privileges

Step 1: Generate a new SSH key pair

The first step is to generate a new SSH key pair that will be used to authenticate with your YubiKey. Open a terminal window and type the following command:

ssh-keygen -t ed25519-sk

This command will generate a new SSH key pair using the Ed25519 algorithm and store it on your YubiKey.

Step 2: Configure OpenSSH to use the YubiKey

Next, we need to configure OpenSSH to use the YubiKey for authentication. Open the sshd_config file located in C:\ProgramData\ssh (or C:\Program Files\OpenSSHtc\ssh if you installed OpenSSH manually) using a text editor with administrative privileges. Add the following line to the end of the file:

AuthenticationMethods publickey,keyboard-interactive

This line specifies that authentication should be performed using public key authentication and interactive keyboard authentication.

Step 3: Restart the OpenSSH service

After making changes to the sshd_config file, you need to restart the OpenSSH service for the changes to take effect. Open a PowerShell window with administrative privileges and type the following command:

Restart-Service sshd

Step 4: Add the public key to the server

Next, we need to add the public key to the server we want to connect to. Log in to the remote server and create the .ssh directory if it doesn't already exist:

mkdir ~/.ssh

Then, append the contents of your public key file ( to the authorized_keys file:

cat >> ~/.ssh/authorized_keys

Step 5: Test the SSH connection

Finally, we can test the SSH connection using our YubiKey for authentication. Open a PowerShell window on your Windows machine and type the following command:

ssh username@remote_server

You should be prompted to touch your YubiKey to authenticate. Once authenticated, you should be logged in to the remote server.

In this article, we explored how to use YubiKey for SSH authentication on Windows. By following these simple steps, you can add an extra layer of security to your SSH connections. With YubiKey, you can ensure that only you have access to your accounts, and your data is secure from cyber-attacks.

Related Searches and Questions asked:

  • Looking for MobaXterm Alternative? Here are Some Options to Consider
  • MobaXterm vs Putty: Which One Should You Choose?
  • How to Use YubiKey for Secure SSH Authentication
  • MobaXterm SSH Key
  • That's it for this post. Keep practicing and have fun. Leave your comments if any.

    Post a Comment

    Cookie Consent
    We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
    It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
    AdBlock Detected!
    We have detected that you are using adblocking plugin in your browser.
    The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
    Site is Blocked
    Sorry! This site is not available in your country.