OpenSSH on Windows

Quick and Dirty install of OpenSSH under Windows Server 2012R2 to obtain SFTP/SSH login.


https://github.com/PowerShell/Win32-OpenSSH/releases
https://github.com/PowerShell/Win32-OpenSSH/releases/download/2_25_2016/OpenSSH-Win64.zip
https://github.com/PowerShell/Win32-OpenSSH/releases/download/2_25_2016/OpenSSH-Win32.zip

extract to c:\openssh-win64

open powershell and configure:
cd C:\OpenSSH-Win64
Set-ExecutionPolicy Bypass
.\install-sshlsa.ps1
Set-ExecutionPolicy Default

Your rsa key pair now exists as:
ssh_host_rsa_key
ssh_host_rsa_key.pub

Edit sshd_config
change:
Subsystem sftp c:\openssh-win64\sftp-server.exe
Subsystem scp c:\openssh-win64\scp.exe (only if you want scp, otherwise you can leave it commented# out)

Create a local windows user: (launch via powershell or ‘Run’ cmd)
PS C:\OpenSSH-Win64> compmgmt.msc

NOTES:
ChrootDirectory does not work under windows!
home dir is c:\users\<username> and cannot be changed. That means when you sftp or ssh /telnet to the machine you will see most of the usual folders:
Desktop, Documents, Downloads, Favorites, Links, Music, Pictures, Saved Games, Videos
You can also traverse up (ie, c:\users) the path as there is no root set. NTFS permissions control what the user has access to.
(this post is partially from memory so I may be missing a step..)

Advertisements