Windows Server: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
Line 1: Line 1:
== Set the default shell to be bash ==
== Set the default shell used by OpenSSH to be bash ==


First install Git in C:\Git!
First install git via chocolatey, see [[Portable Windows]]!


PowerShell "Run as Administrator"
PowerShell "Run as Administrator"


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


== OpenSSH ==
== OpenSSH ==

Revision as of 21:06, 23 June 2021

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

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.