--- type: "topic" created: "2024-01-14T02:18:17.942Z" updated: "2024-01-14T03:32:28.219Z" --- # SSH ```bash %WINDIR%\System32\OpenSSH %ProgramData%\ssh %USERPROFILE%\.ssh ``` ```bash https://api.github.com/users/mikepharesjr/keys sudo -i exit ssh-import-id gh:mikepharesjr ``` ```PowerShell Administrator Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*' # Install the OpenSSH Client Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 # Install the OpenSSH Server Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 ``` ```bash dism /Online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0 ``` ```PowerShell Administrator New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Program "C:\Windows\System32\OpenSSH\sshd.exe" ``` ```PowerShell ssh-keygen -t ed25519 ``` ```bash puttygen "C:\Users\mikep\.ssh\id_ed25519" ``` ```PowerShell Administrator copy $env:USERPROFILE\.ssh\id_ed25519.pub C:\ProgramData\ssh\authorized_keys copy $env:USERPROFILE\.ssh\id_ed25519.pub C:\ProgramData\ssh\administrators_authorized_keys icacls.exe "C:\ProgramData\ssh\authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F" icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F" code-insiders "C:\ProgramData\ssh" ``` ```PowerShell Administrator Start-Service sshd ``` ```conf # After default PubkeyAuthentication yes PasswordAuthentication no ``` ```bash certlm.msc ```