Windows Server

From Wildsong
Revision as of 18:01, 26 November 2019 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

Set the default shell to be bash

First install Git in C:\Git!

PowerShell "Run as Administrator"

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\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

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.