Це стара версія документу!
В сучасних версіях Віндоус є компонент OpenSSH, але він необов'язковий.
в адмінський PowerShell-console:
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Client*'
в адмінський PowerShell-console:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Це має бути C:\Users\<username>\.ssh\. Виконати в адмінській powershell-консолі. Створимо каталог, встановимо пермішени та перейдемо в нього:
$username = $env:USERNAME $newDirectoryPath = "C:\Users\$username\.ssh" try { New-Item -ItemType Directory -Path $newDirectoryPath -ErrorAction Stop Write-Host "Created directory: $newDirectoryPath" } catch { Write-Host "Failed to create directory: $($_.Exception.Message)" } icacls $newDirectoryPath /grant:r "$($env:USERNAME):(F)" /grant:r "SYSTEM:(RX)" /inheritance:r New-Item -Path "$newDirectoryPath\config" -ItemType File Set-Location $newDirectoryPath
Passphrase створювати й пам'ятати!
ssh-keygen -t rsa -b 4096 -C "peter@compname" ssh-keygen -t ed25519 -C "peter@compname"
Потім оновити дозволи:
icacls "$env:USERPROFILE\.ssh\id_ed25519" /reset icacls "$env:USERPROFILE\.ssh\id_ed25519" /inheritance:r icacls "$env:USERPROFILE\.ssh\id_ed25519" /grant:r "$($env:USERNAME):(R,D)"
Відкрити вже існуючий файл C:\Users\$username\.ssh\config і заповнити:
##############
## Personal ##
##############
Host pi
HostName 192.168.50.14
IdentityFile ~/.ssh/id_ed25519
##############
## Defaults ##
##############
Host *
ForwardAgent no
ForwardX11 no
User charon
Port 22
Protocol 2
ServerAliveInterval 60
ServerAliveCountMax 30
# Ensure KnownHosts are unreadable if leaked - it is otherwise easier to know which hosts your keys have access to.
HashKnownHosts yes
# Host keys the client accepts - order here is honored by OpenSSH
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr