A password is a secret you type - it can be guessed, leaked or phished. An SSH key is a secret you never type and never send. This page sets up key login on your Windows SFTP server and explains honestly when it is worth the extra ten minutes.
Every SFTP login in the quick setup uses a password. That is fine on a home LAN. The moment the server matters - client files, office data, any exposure beyond your own rooms - key login is the upgrade that counts. The idea is simple: your client PC holds a private key file that never leaves it, the server holds the matching public key, and the two prove the match mathematically. There is no password crossing the network to steal.
On the PC that will connect, open PowerShell and run ssh-keygen -t ed25519. Press Enter to accept the default location and set a passphrase when asked - the passphrase protects the key file if the PC itself is stolen. Two files appear in C:\Users\yourname\.ssh: id_ed25519 (private - guard it) and id_ed25519.pub (public - this is the one you copy to the server).
Copy the single line of text from the .pub file into the server's authorized_keys file for that user. For a normal SFTP user that file is C:\Users\username\.ssh\authorized_keys on the server. There is one Windows trap: if the account is a member of Administrators, OpenSSH ignores the per-user file and reads C:\ProgramData\ssh\administrators_authorized_keys instead. That shared file also needs strict permissions - administrators and SYSTEM only - or logins are refused. In an administrator PowerShell: icacls C:\ProgramData\ssh\administrators_authorized_keys /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
sftp username@server-ip - you should be asked for the key passphrase, not the account passwordC:\ProgramData\ssh\sshd_config confirm PubkeyAuthentication yes and set PasswordAuthentication noRestart-Service sshd and test a fresh connectionFrom now on, password guessing attacks against this server are pointless - there is no password login to guess.
Keys are stronger, not effortless. Each device needs its own key pair - do not copy one private key onto five PCs and a phone. A lost private key with a weak passphrase is a lost credential, so passphrases matter. And if you disable password login before testing the key properly, you can lock yourself out and will need to sit at the server PC to fix the config. Done in the order above, key login is the single biggest safety upgrade an SFTP server can get.
See the complete SFTP server setup on screen, step by step, in the Technical Anshu video.
Watch Full VideoA password can be guessed by software trying thousands of combinations and can be phished or reused. A private key is never sent over the network and cannot be guessed in any realistic time - the server only checks a mathematical proof. Even a perfect password cannot offer that.
The usual causes are the administrators-group trap - admin accounts read C:\ProgramData\ssh\administrators_authorized_keys instead of the per-user file - and loose file permissions. OpenSSH on Windows refuses key files that other accounts can modify.
You can, but the backup door is exactly what attackers use. Keep password login only while testing, then switch it off and rely on sitting at the server console if a key is ever lost.