Categories
Tags
Agent Mode Astro Auto Accept Automation Camping changelog Chat clear CLI Code Actions Codex compact Component Design Configuration context Context Copilot copy Ctrl+S CUDA Cursor Day Trip delegate diff Dynamic Routing Editor Error Error Fix Error Handling experimental Gemini git GitHub GitHub Copilot Google Hiking Hot Springs init Installation Iwate Prefecture Kobe Linux Localization Mac Mention Meteor Shower Mode Switching model Nara Prefecture NES NoAdapterInstalled Node.js nvm OpenAI params plan PowerShell Prompt props Public Key Authentication Python Redirect Reference Rename research rewind SEO Settings share Shell Execution Shift+Tab Shortcut SSH SSH config ssh-copy-id Stargazing Static Site streamer-mode Student undo Update usage 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/
