Hereβs a refined and professionally structured version of your instructions for configuring the SSH client and server with FIDO2 security keys:
Insert your security key.
Open a terminal.
Generate the SSH credentials:
ssh-keygen -t ed25519-sk -O resident -O verify-required -C "Your Comment"
When prompted, enter your PIN and touch the security key.
Save the generated files (id_ed25519_sk
and id_ed25519_sk.pub
) to the ~/.ssh
directory.
Install OpenSSH via Homebrew if needed:
brew install openssh
source ~/.profile
Insert your security key.
Open a terminal and generate the SSH credentials:
sudo ssh-keygen -t ed25519-sk -O resident -O verify-required -C "Your Comment"
When prompted, enter your PIN and touch the key.
Save the files to your ~/.ssh
directory.
Ensure OpenSSH is installed. See Microsoft's guide.
Insert your security key.
Open PowerShell as Administrator and run:
ssh-keygen -t ed25519-sk -O resident -O verify-required -C "Your Comment"
Enter your PIN and touch the key when prompted.
Save the credential files in your ~/.ssh
directory.
To use the security key on another system:
Insert the key and open a terminal.
Navigate to your SSH directory:
cd ~/.ssh
Regenerate the key files from the security key:
ssh-keygen -K
To enforce FIDO2 user verification:
Edit the SSH server config file (commonly found at /etc/ssh/sshd_config
).
Add or update the following line:
PubkeyAuthOptions verify-required
Save and exit the file.
Restart the SSH service:
sudo systemctl restart sshd
sshd_config
Example# Enable public key authentication (includes FIDO2)
PubkeyAuthentication yes
# Require FIDO2 user verification (PIN + touch)
PubkeyAuthOptions verify-required
# Location of authorized public keys
AuthorizedKeysFile .ssh/authorized_keys
# Restrict root login to MFA only
PermitRootLogin prohibit-password
# Disable password-based authentication
PasswordAuthentication no
PermitEmptyPasswords no