Monorepo for Aesthetic.Computer aesthetic.computer
at main 48 lines 2.1 kB view raw
1# Setup OpenSSH Server on Windows 2# Run this in PowerShell as Administrator 3 4Write-Host "🔧 Setting up OpenSSH Server on Windows..." -ForegroundColor Cyan 5 6# Install OpenSSH Server 7Write-Host "`n📦 Installing OpenSSH Server..." 8Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 9 10# Start and enable SSH service 11Write-Host "`n🚀 Starting SSH service..." 12Start-Service sshd 13Set-Service -Name sshd -StartupType 'Automatic' 14 15# Configure firewall 16Write-Host "`n🔥 Configuring firewall..." 17if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) { 18 New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' ` 19 -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 20} 21 22# Set PowerShell as default shell (optional but recommended) 23Write-Host "`n🐚 Setting PowerShell as default SSH shell..." 24New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell ` 25 -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" ` 26 -PropertyType String -Force 27 28# Create .ssh directory for authorized_keys 29$sshDir = "$env:PROGRAMDATA\ssh" 30if (!(Test-Path $sshDir)) { 31 New-Item -ItemType Directory -Path $sshDir 32} 33 34Write-Host "`n✅ OpenSSH Server setup complete!" -ForegroundColor Green 35Write-Host "" 36Write-Host "Next steps:" -ForegroundColor Yellow 37Write-Host "1. Copy your public key from the devcontainer:" 38Write-Host " cat ~/.ssh/id_ed25519.pub # or id_rsa.pub" 39Write-Host "" 40Write-Host "2. Add it to: C:\ProgramData\ssh\administrators_authorized_keys" 41Write-Host " (Create the file if it doesn't exist)" 42Write-Host "" 43Write-Host "3. Set proper permissions on administrators_authorized_keys:" 44Write-Host ' icacls "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r' 45Write-Host ' icacls "C:\ProgramData\ssh\administrators_authorized_keys" /grant SYSTEM:(F)' 46Write-Host ' icacls "C:\ProgramData\ssh\administrators_authorized_keys" /grant BUILTIN\Administrators:(F)' 47Write-Host "" 48Write-Host "Your Windows IP (from container): 172.17.0.1"