Skip to content

Instantly share code, notes, and snippets.

@cyrex562
Created June 21, 2017 10:53
Show Gist options
  • Save cyrex562/148bd587fef5c10d9a2c111294df5bb8 to your computer and use it in GitHub Desktop.
Save cyrex562/148bd587fef5c10d9a2c111294df5bb8 to your computer and use it in GitHub Desktop.
  1. Download SSH binaries from https://github.com/PowerShell/Win32-OpenSSH/releases/
  2. Extract the archive to C:\Program Files\OpenSSH
  3. Open powershell as an administrator
  4. CD to directory where OpenSSH was extracted: cd c:\Program Files\OpenSSH
  5. Install OpenSSH powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
  6. Generate server keys and restrict access to them .\ssh-keygen.exe -A
  7. Open a port for SSH in the firewall: New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH
  8. Start the sshd service and configure it for automatic start
  9. In powershell, CD to the user's home directory cd c:\users\{user}
  10. Create a directory for ssh key data: mkdir .ssh
  11. Allow the ssh service access to the directory `icacls C:\users{user}.ssh /grant "NT Service\sshd:R" /T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment