Skip to main content

Disable Password Authentication in OpenSSH on Windows

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".

image

image

Open the configuration file in the terminal​

Run the following command:

notepad C:\ProgramData\ssh\sshd_config

image

Edit the configuration file​

- # PasswordAuthentication yes
+ PasswordAuthentication no

image

Change it to

image

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.

Comments

Loading...

Post a Comment

★★★★★