OpenSSH is a suite of secure networking utilities based on the Secure Shell protocol, which provides a secure channel over an unsecured network in a client–server architecture.
Windows
Start an SSH server on Windows. See Official Documentation.
Installation
Download OpenSSH
https://github.com/PowerShell/Win32-OpenSSH/releases
wget -O OpenSSH-Win32-v8.9.1.0.msi https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.9.1.0p1-Beta/OpenSSH-Win32-v8.9.1.0.msi
Install OpenSSH
Will create a directory: C:\Program Files (x86)\OpenSSH
C:\OpenSSH-Win32-v8.9.1.0.msi
wget https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.9.1.0p1-Beta/OpenSSH-Win32.zip
powershell -c "(new-object System.Net.WebClient).DownloadFile('http://KALI_IP/OpenSSH-Win32.zip','C:\OpenSSH-Win32.zip')"
Extract zip file.
powershell C:\OpenSSH-Win32\OpenSSH-Win32\install-sshd.ps1
net start sshd
netstat -ano | findstr 22
Configure OpenSSH
cd "C:\Program Files (x86)\OpenSSH"
type sshd_config_default
"C:\Program Files (x86)\OpenSSH\sshd.exe"
# net stop sshd
sc query sshd
powershell
# Start the sshd service
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}