Skip to content


How to control Windows 10 via SSH

  1. Download SSH-server from github https://github.com/PowerShell/Win32-OpenSSH/releases/ and install.
  2. Start and enable auto-start after booting in powershell console:
    Start-Service sshd
    Set-Service -Name sshd -StartupType 'Automatic'
  3. Allow incoming connection in Windows Firewall:
    New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
  4. Enable password-less authentication:
    Add-Content -Path "C:\ProgramData\ssh\administrators_authorized_keys" -Value "your_public_key_here"
    icacls "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "SYSTEM:(F)" /grant "ADMINISTRATORS:(F)"
  5. To make PowerShell the default shell permanently:
    New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" `
      -Name DefaultShell `
      -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" `
      -PropertyType String -Force

After that you can run from linux commands on remove windows-machine like this:

ssh myuser@192.168.0.13 'gps | where Name -like "*notepad*"'
ssh myuser@192.168.0.13 'Stop-Process -Name "notepad" -Force'

Posted in Misc.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.