On Arm64 Windows the VirtIO guest tools installer is an x86 program and the VirtIO ISO has no Arm64 package for it, so the first-logon script failed there and the guest had no network (no NetKVM driver). Install the Arm64 NetKVM, vioserial, Balloon, viorng and vioinput drivers from their folders on the ISO with pnputil instead. The OpenSSH Server capability is downloaded through Windows Update, which can take very long and blocked the rest of the script. Move it, with the administrator authorized key, into 05-Install-OpenSSH-Admin.bat, which the script copies to the Installers folder on the desktop to run by hand. Update the vm-images submodule to the build script that runs on Debian. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
51 lines
2.0 KiB
Batchfile
51 lines
2.0 KiB
Batchfile
@echo off
|
|
setlocal
|
|
title Install OpenSSH Server
|
|
|
|
fltmc >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Please right-click this file and choose "Run as administrator".
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
rem The capability is downloaded through Windows Update, which can be slow.
|
|
echo Installing the OpenSSH Server Windows capability...
|
|
dism.exe /Online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0
|
|
set "RC=%ERRORLEVEL%"
|
|
if not "%RC%"=="0" if not "%RC%"=="3010" (
|
|
echo dism exited with code %RC%.
|
|
pause
|
|
exit /b %RC%
|
|
)
|
|
|
|
echo Starting the sshd service...
|
|
sc.exe config sshd start= auto
|
|
net.exe start sshd >nul 2>&1
|
|
sc.exe query sshd | find "RUNNING" >nul
|
|
if errorlevel 1 (
|
|
echo The sshd service is not running.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
netsh.exe advfirewall firewall show rule name="OpenSSH-Server-In-TCP" >nul 2>&1
|
|
if errorlevel 1 (
|
|
netsh.exe advfirewall firewall add rule name="OpenSSH-Server-In-TCP" ^
|
|
dir=in action=allow protocol=TCP localport=22 profile=private,public
|
|
)
|
|
|
|
echo Installing the administrator authorized key...
|
|
set "KEYFILE=%ProgramData%\ssh\administrators_authorized_keys"
|
|
> "%KEYFILE%" echo ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCwsF2ZDSHDaXM9BdDq3Vxkp6T+DJEakKaVZQJUEHexS34mbrxYAxmGBUPCrddfE01dS31kGS4XHVBa+wGUYodY+nPwnrfD1Q4phKVSzXr65K1Y/sCcjSiANBPWpv2Xd7IMOfLlrdLtmf5QcKWroIqO2LaIDGECwzUUHrfprgeaF9N0FGcmrgbmm23JUk+f6guRQ4br88L4rWIWEBvL9bTdwErNkdfsYE2F/U8aIFpMcVy2eJIOgy8ZjZvkGdm4r730YkTDL1VmAjiHH3/m2R1EOvwLzFhyWKoa4ULk/IQW+8iNnG42QEcaWRM+hMwlVdnNhPJP6WzS+fAEbibD3zM0q2X/4ex+cXRNOCd2/0KhnD2+3p1BM5QeFTzDappkk8W2meQkDE3hvTjtIQCzygFO6LNWtEEa7BTvvlMqF3CZWh88J9XiP750SjESe3Ge5o9A0T2hcJa+KZ1LxVEmNt4nD6E/OD4EymoaLIJZ1fH5ksSFjHzJ+mJouSVjc/H/VSE= guofang@GUOFANG-OFFICE
|
|
icacls.exe "%KEYFILE%" /inheritance:r /grant "*S-1-5-32-544:F" /grant "*S-1-5-18:F" >nul
|
|
if errorlevel 1 (
|
|
echo icacls exited with code %ERRORLEVEL%.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Done. SSH is available on port 22 of this machine.
|
|
pause
|
|
exit /b 0
|