Openssh install

From wikinotes

Documentation

openssh manpages https://www.openssh.com/manual.html
windows ssh https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

Unix

pacman -S openssh

Windows

Native

# powershell
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0  # server
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0  # client

# enable
Start-Service sshd

Recommended configuration

Set-Service -Name sshd -StartupType 'Automatic'

# Confirm the Firewall rule is configured. It should be created automatically by setup.
Get-NetFirewallRule -Name *ssh*

# There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled
# If the firewall does not exist, create one
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

Cygwin

Running SSH server from cygwin (predates native windows ssh).
https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150

## Unfortunately, cygwin does not always properly perform dependency checks
## during silent installs. Installing openssh requires finding it's dependencies.
##
## find dependencies for openssh AFTER a clean GUI
## install:

grep depend /var/log/setup.log | awk '{ print $6 }' | sed 's/.$//'

from within cygwin.

cygwin-setup.exe -L -l C:\MyLocalPackageStore -R C:\cygwin -q --packages ^
openssh bzip2 ca-certificates csih cygrunsrv diffutils groff less libargp ^
libasn1_8 libattr1 libbz2_1 libcom_err2 libcrypt0 libedit0 libffi6 libgcc1 ^
libgmp10 libgssapi3 libheimbase1 libheimntlm0 libhx509_5 libiconv2 libintl8 ^
libkafs0 libkrb5_26 liblzma5 libmpfr4 libncursesw10 libopenssl100 libp11-kit0 ^
libpcre1 libpopt0 libreadline7 libroken18 libsqlite3_0 libssp0 libstdc++6 libtasn1_6 ^
libwind0 libwrap0 p11-kit p11-kit-trust popt terminfo xz _autorebase

c:\cygwin\bin\bash --login -c "/bin/ssh-host-config -y -c ntsec -u sshd_account -w <your password here>"
 
netsh advfirewall firewall add rule name=SSH dir=in action=allow protocol=tcp localport=22
 
net start sshd