Windows Server: Difference between revisions
Brian Wilson (talk | contribs) Created page with "== Set the default shell to be bash == New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Git\bin\bash.exe" -PropertyType String -Force" |
Brian Wilson (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Set the default shell to be bash == | == Set the default shell used by OpenSSH to be bash == | ||
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Git\bin\bash.exe" -PropertyType String -Force | 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. |
Latest revision as of 21:09, 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
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.