Disable Password Authentication in OpenSSH on Windows
· One min read
Open an elevated terminal
You need administrator privileges to edit the configuration file, so open a terminal with administrator privileges.
Right-click on the terminal icon and select "Run as administrator".


Open the configuration file in the terminal
Run the following command:
notepad C:\ProgramData\ssh\sshd_config

Edit the configuration file
- # PasswordAuthentication yes
+ PasswordAuthentication no

Change it to

and save the changes.
Restart the SSH server
Return to the terminal and run the following command to restart the SSH server:
Restart-Service sshd
Connection test
Test if the configuration is enabled.
Run the following command and if you see:
ssh localhost
user@localhost: Permission denied (publickey,keyboaard-interactive).
Then it's OK.
