Update scripts to use dynamic username instead of hardcoded alexz
Some checks failed
Test / test (push) Has been cancelled

- setup-autologin-sshd.ps1: Uses $env:USERNAME, prompts for password
- setup-ssh-keys.ps1: Uses $env:USERNAME, prompts for public key
- install-nodejs.ps1: Uses $env:USERNAME in instructions
- vpn-login.js: Uses process.env.USERPROFILE for paths

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-18 08:44:33 +00:00
parent 069ad3880f
commit 5ed8f84419
4 changed files with 34 additions and 15 deletions

View File

@@ -1,12 +1,23 @@
# Setup SSH Keys for alexz user
# Setup SSH Keys
# Run as Administrator in PowerShell
$PublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHUQnw0WfeFRQx76UlImXXhu3xeOH41PmDRid8pWK1D alexz@AZawPC-P16S"
param(
[string]$Username = $env:USERNAME,
[string]$PublicKey
)
Write-Host "=== Setting up SSH Keys ===" -ForegroundColor Cyan
if (-not $PublicKey) {
# Default public key - replace with your own or pass as parameter
$PublicKey = Read-Host "Enter SSH public key (or press Enter for default)"
if (-not $PublicKey) {
$PublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHUQnw0WfeFRQx76UlImXXhu3xeOH41PmDRid8pWK1D"
}
}
Write-Host "=== Setting up SSH Keys for $Username ===" -ForegroundColor Cyan
# User authorized_keys
$userSshDir = "C:\Users\alexz\.ssh"
$userSshDir = "C:\Users\$Username\.ssh"
$userAuthKeys = "$userSshDir\authorized_keys"
Write-Host "Creating user .ssh directory..." -ForegroundColor Yellow
@@ -16,7 +27,7 @@ Write-Host "Adding key to user authorized_keys..." -ForegroundColor Yellow
Add-Content -Path $userAuthKeys -Value $PublicKey -Force
# Fix permissions for user file
icacls $userAuthKeys /inheritance:r /grant "alexz:F" /grant "SYSTEM:F"
icacls $userAuthKeys /inheritance:r /grant "${Username}:F" /grant "SYSTEM:F"
# Administrator authorized_keys (for admin users)
$adminAuthKeys = "C:\ProgramData\ssh\administrators_authorized_keys"
@@ -28,5 +39,5 @@ Add-Content -Path $adminAuthKeys -Value $PublicKey -Force
icacls $adminAuthKeys /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
Write-Host ""
Write-Host "SSH keys configured!" -ForegroundColor Green
Write-Host "You can now SSH in with the id_ed25519-lenovo key." -ForegroundColor Yellow
Write-Host "SSH keys configured for '$Username'!" -ForegroundColor Green
Write-Host "You can now SSH in with the corresponding private key." -ForegroundColor Yellow