Skip to content

Instantly share code, notes, and snippets.

@fa0311
Last active April 30, 2024 09:56
Show Gist options
  • Save fa0311/8abe6f3d856354448a6caf13fa5118b9 to your computer and use it in GitHub Desktop.
Save fa0311/8abe6f3d856354448a6caf13fa5118b9 to your computer and use it in GitHub Desktop.
Windows を SSH サーバーにするTips
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("Administrators")) { Start-Process powershell.exe "-File `"$PSCommandPath`"" -Verb RunAs; exit }
Start-Service sshd
@fa0311
Copy link
Author

fa0311 commented May 8, 2023

スタートアップに追加

Set-Service -Name sshd -StartupType 'Automatic'

@fa0311
Copy link
Author

fa0311 commented May 8, 2023

PowerShellに変更

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

Git bashに変更

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment