Windows Server

From Wildsong
Revision as of 21:09, 23 June 2021 by Brian Wilson (talk | contribs) (→‎Public key auth)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Set the default shell used by OpenSSH to be bash

First install git via chocolatey, see Portable Windows!

PowerShell "Run as Administrator"

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force

OpenSSH

Windows Server comes with an OpenSSH server, you just have to enable it. Refer to https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview

Public key auth

I changed the administrators group in the last 2 lines of C:/ProgramData/ssh/sshd_config to Clatsop\CSAdministrator. I am not sure if that's the best group to use but I am in it! And it works for me. I set permissions on the file ssh\administrators_authorized_keys and I copied my public key into it. But there is a glitch in setting up public key authentication. It only accepts files in utf-8 format. This fixes it.

copy administrators_authorized_keys temp
Get-Content .\temp | Set-Content -Encoding utf8 .\administrators_authorized_keys
del temp
Restart-Service sshd

Debug OpenSSH

During testing I turned on logging to logs/ using LOCAL0 as the facility and put level to DEBUG. I commented those lines out once I fixed the UTF8 bug.