John Siu Blog

Tech - Business Tool, Personal Toys

SSH into Windows

☰ Table of Content

With Windows 10 and 11, you can ssh into your Windows machine, with ssh key too.

Install OpenSSH Server

  1. Go to Windows Settings

    Before

  2. Select Apps then Optional features

    Before

  3. Click View features

    Before

  4. Search ssh, checkmark OpenSSH Server, click Next

    Before

  5. Click Install

    Before

Enable OpenSSH Service

OpenSSH service not enable by default.

  1. Open service manager

  2. Double click OpenSSH SSH Server

  3. In General Tab

    • Select Automatic for Startup type
    • Click Start
    • Click Apply

    Before

Microsoft Account

SSH sign-in to Windows 10/11, both local accounts and Microsoft accounts can be used.

To use Microsoft accounts(eg. Hotmail), you have to find out the shorten name of your account. It is your home directory name in C:\Users\. Then you can login ssh with the shorten name using Microsoft account password.

SSH Key

To use ssh key with Windows, you do the same as Linux, almost.

Standard User

For standard Windows user, you do the same as Linux. Put the public key inside

C:\Users\<username>\.ssh\authorized_keys

Administrator

The first account of Windows is always an administrator account.

Unlike Linux, Windows administrators do not use home directory authorized_keys. ALL administrators public keys are to be put in

C:\ProgramData\ssh\administrators_authorized_keys

One per line.

If a standard account is promoted to administrator account, its home directory authorized_keys file will stop working, and its public key need to be put into the above file.

On the other hand, if an administrator account is demoted to standard, it will revert back to home directory setup like the previous section.

John Siu

Update: 2023-07-23
Tag
[ssh]
comments powered by Disqus