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) mNo edit summary |
||
Line 1: | Line 1: | ||
== Set the default shell to be bash == | == 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 | 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. |
Revision as of 18:01, 26 November 2019
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.