Categories
Tags
Astro Camping CLI Codex Component Design Configuration Copilot CUDA Cursor Day Trip Dynamic Routing Editor Error Error Fix Error Handling Gemini git GitHub GitHub Copilot Google Hiking Hot Springs Installation Iwate Prefecture Kobe Linux Mac Meteor Shower Nara Prefecture NoAdapterInstalled Node.js nvm OpenAI params PowerShell props Public Key Authentication Python Redirect SEO SSH SSH config ssh-copy-id Stargazing Static Site Student Visual Studio VS Code VS2026 Windows WSL
157 words
1 minutes
How to Use ssh-copy-id on Windows with WSL
Table of Contents
Introduction
When I needed to set up SSH public key authentication from Windows to Ubuntu for my research, I found that the ssh-copy-id command wasn’t available natively. This guide shows how to use ssh-copy-id through WSL to register your public key on a server.
Prerequisites
- WSL is installed on Windows
- You can reach the server with
ssh user@host
Steps
1. Launch WSL
wslRun the following commands inside WSL.
2. Prepare SSH Keys
mkdir -p ~/.ssh
chmod 700 ~/.sshCreate a New Key
ssh-keygen -t ed25519 -f ~/.ssh/key- Private key:
~/.ssh/key - Public key:
~/.ssh/key.pub
Use an Existing Windows Key
Copy your Windows SSH key to WSL:
cp /mnt/c/Users/YourUsername/.ssh/id_ed25519 ~/.ssh/key
cp /mnt/c/Users/YourUsername/.ssh/id_ed25519.pub ~/.ssh/key.pub
chmod 600 ~/.ssh/keyReplace
/mnt/c/Users/YourUsername/with your actual Windows home directory. Adjust the key filename as needed.
3. Register Public Key on Server
ssh-copy-id -i ~/.ssh/key.pub user@hostYou’ll be prompted for a password on the first connection.
4. Verify Connection
ssh -i ~/.ssh/key user@hostIf you can connect without a password, you’re done.
Related Articles
To skip the
-ioption every time, set up SSH config.
How to Set Up SSH Config
How to Use ssh-copy-id on Windows with WSL
https://naonao-na.com/en/posts/ssh-copy-id-windows/
