Skip to content

Instantly share code, notes, and snippets.

@SARDONYX-sard
Created July 29, 2022 09:37
Show Gist options
  • Save SARDONYX-sard/01945825c75377432ba854600b62d471 to your computer and use it in GitHub Desktop.
Save SARDONYX-sard/01945825c75377432ba854600b62d471 to your computer and use it in GitHub Desktop.
How to connect to Windows via ssh using OpenSSH server
# How to automation ssdh?
#
# 1. Execute `compmgmt.msc` on powershell
# 2. Service & application -> duble click service
# 3. Find `OpenSSH SSH Server`
# 4. Select `automation` of `A kind of startup` item
# Are you root?(need `sudo command`. use `winget install gsudo)
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")) {
Invoke-Expression "sudo $PsCommandPath $(if ($force) {"-force"})"
Write-Error "Need Administrator"
exit $?
}
Start-Service sshd
@SARDONYX-sard
Copy link
Author

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