Installing SSH on Windows Server

From Logic Wiki
Jump to: navigation, search


Installing OPEN SSH

On the Windows Server

  • Go to Settings/Apps/Optional Features/Add Feature/Open SSH Server
  • To make service automatic and started run these
## changes the sshd service's startup type from manual to automatic.
 Set-Service sshd -StartupType Automatic
## starts the sshd service.
 Start-Service sshd
  • To enable firewall if necessary
New-NetFirewallRule -Name sshd -DisplayName 'Allow SSH' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

Setting up key authentication

  • Run ssh-keygen -t rsa in powershell
  • Go to <user>\.ssh folder and copy id_rsa.pub

More Settings on Server

  • Open C:\ProgramData\ssh\sshd_config file
  • delete the remarks for these lines
    • PubkeyAuthentication yes
    • StrictModes no
  • create a file "C:\ProgramData\ssh\administrators_authorized_keys"
  • copy content of <user>\.ssh\id_rsa.pub into it
  • icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "boadminukswinboprdev:F" /grant "SYSTEM:F"
  • restart sshd service
restart-service sshd


  • connect from your computer with this
 ssh -i ~/.ssh/id_rsa USER@SERVER_NAME