🪟 Windows → Debian: Manual SSH Key Setup
✅ 1. Generate an SSH key on Windows
If you haven’t already, open PowerShell or Git Bash and run:
ssh-keygen -t ed25519 -C "[email protected]"
- Press Enter to accept the default location (
C:\Users\<YourName>\.ssh\id_ed25519). - Optionally set a passphrase for extra security, or leave it empty for passwordless login.
📋 2. Copy the public key to the Debian server
Option A: Pipe the public key over SSH (PowerShell)
This method appends your public key directly into the remote user’s authorized_keys file:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh username@your-server-ip "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
Option B: Manual copy via clipboard
- Open your public key file locally:
notepad $env:USERPROFILE\.ssh\id_ed25519.pub
- Copy the entire contents.
- SSH into your Debian server:
ssh username@your-server-ip
- On the server, create the
.sshdirectory and editauthorized_keys:
mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys
- Paste the public key, save, and exit.
- Set secure permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
🔐 3. Test passwordless login
From your Windows machine run:
ssh username@your-server-ip
If everything is configured correctly you should log in without being prompted for a password.
Notes:
- If the server still prompts for a password, verify the key was pasted correctly and permissions are set on the server.
- Check
sshdconfiguration on the server (/etc/ssh/sshd_config) to ensurePubkeyAuthentication yesandAuthorizedKeysFile .ssh/authorized_keysare present.