🪟 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

  1. Open your public key file locally:
notepad $env:USERPROFILE\.ssh\id_ed25519.pub
  1. Copy the entire contents.
  2. SSH into your Debian server:
ssh username@your-server-ip
  1. On the server, create the .ssh directory and edit authorized_keys:
mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys
  1. Paste the public key, save, and exit.
  2. 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 sshd configuration on the server (/etc/ssh/sshd_config) to ensure PubkeyAuthentication yes and AuthorizedKeysFile .ssh/authorized_keys are present.

Related Posts