Користувальницькькі налаштування

Налаштування сайту


software:os:windows:ssh

Розбіжності

Тут показані розбіжності між вибраною ревізією та поточною версією сторінки.

Посилання на цей список змін

Наступна ревізія
Попередня ревізія
software:os:windows:ssh [2025/05/11 23:07]
charon створено
software:os:windows:ssh [2025/05/15 22:40] (поточний)
charon [Створимо каталог для конфігів]
Рядок 8: Рядок 8:
 ===== Інсталювати ===== ===== Інсталювати =====
 в адмінський PowerShell-console: в адмінський PowerShell-console:
-  Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0  +  Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 
 + 
 +===== Налаштування ===== 
 +==== Створимо каталог для конфігів ==== 
 +Це має бути //C:\Users\<username>\.ssh\//
 +Виконати в адмінській powershell-консолі.  
 +Створимо каталог, встановимо пермішени та перейдемо в нього: 
 +<code powershell> 
 +$username = $env:USERNAME 
 +$newDirectoryPath = "C:\Users\$username\.ssh" 
 + 
 +# Create .ssh directory 
 +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:
 +# Create empty .ssh/config file 
 +New-Item -Path "$newDirectoryPath\config" -ItemType File 
 +icacls.exe "$newDirectoryPath\config" /setowner $env:USERNAME 
 +icacls.exe "$newDirectoryPath\config" /grant:r "$($env:USERDOMAIN)\$($env:USERNAME):F" 
 +icacls.exe "$newDirectoryPath\config" /grant:r "SYSTEM:F" 
 +Set-Location $newDirectoryPath 
 +</code> 
 + 
 +==== Створити нові ssh-ключі ==== 
 +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:
 +  icacls "$env:USERPROFILE\.ssh\id_ed25519" /grant:r "$($env:USERNAME):(R,D)" 
 + 
 +==== Створити конфіг ==== 
 +Відкрити вже існуючий файл //C:\Users\$username\.ssh\config// і заповнити: 
 +<file 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 
 +</file>
software/os/windows/ssh.1746994055.txt.gz · Востаннє змінено: 2025/05/11 23:07 повз charon