Created
June 13, 2022 21:12
-
-
Save mwallner/7c01a96c9c03eb00cfe95d6a5c1c8257 to your computer and use it in GitHub Desktop.
WIndows VM Base pwsh and SSH Remoting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
choco install pwsh -y | |
choco install ripgrep -y | |
choco install vscode -y | |
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH*'} | Add-WindowsCapability -Online | |
Start-Service sshd | |
Set-Service sshd -StartupType Automatic | |
Stop-Service sshd | |
$sshd_config = "${env:ProgramData}\ssh\sshd_config" | |
$sshd_bk = "$sshd_config.bk" | |
if (-Not (Test-Path $sshd_bk)) { | |
Move-Item $sshd_config "${env:ProgramData}\ssh\sshd_config.bk" | |
} | |
@" | |
Port 22 | |
AddressFamily any | |
ListenAddress 0.0.0.0 | |
PasswordAuthentication yes | |
PermitEmptyPasswords no | |
Subsystem powershell c:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo | |
"@ | Out-File $sshd_config -Encoding UTF8 | |
Start-Service sshd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment