Multi-User LAN AI Agent Stack: Privilege-Isolated Ollama, Hermes & Open WebUI
Scaling from a single-user workstation to a hardened, multi-user LAN AI platform—orchestrated idempotently across three non-sudo Linux service accounts on a 16GB RTX 5060 Ti.
Status: Multi-User LAN Ready 🚀
The local AI node has evolved into a full multi-user LAN agent stack. A single idempotent Bash orchestrator now provisions isolated nologin system accounts for Ollama, per-user Hermes Agent profiles, and Open WebUI—dynamically budgeting 16GB VRAM concurrency and enforcing strict user-level isolation across the home network.
What We’ve Achieved
- Three-Tier Non-Sudo Privilege Isolation: Split the stack across dedicated, unprivileged
/usr/sbin/nologinsystem users (ollama,hermes-svc, andopenwebui-svc) hardened withsystemdsandboxing (ProtectSystem=strict,ProtectHome=true,PrivateTmp=true, andNoNewPrivileges=true). - Per-User Hermes Agent Profiles: Deployed a parameterized
hermes-profile@.serviceunit where each LAN user gets an isolated profile directory, standalone gateway, localhost-bound port (127.0.0.1:8642+), unique 64-character API key, and configurable tool sandboxing (chat/RAG-only or air-gapped--network=noneDocker containers). - Dynamic 16GB VRAM Concurrency Budgeting: Configured the orchestrator to automatically compute
OLLAMA_NUM_PARALLELandOLLAMA_CONTEXT_LENGTHfrom the chosen Gemma 4 model and registered user count, pairing Flash Attention withq8_0KV cache quantization to prevent VRAM overflow. - Private Model Routing & Clean Sleep Hooks: Locked Open WebUI strictly to the LAN interface behind UFW subnet rules with Private per-user model visibility, and added a
systemdsleep.targethook that evicts loaded models from VRAM (keep_alive: 0) prior to host suspend.
The Multi-User Architecture
# Privilege-separated LAN request flow (enforced by systemd + UFW)
LAN Client ──▶ Open WebUI (LAN_IP:3000, user: openwebui-svc, Private per-user models)
│
├──▶ Hermes Profile: alice (127.0.0.1:8642, user: hermes-svc) ──┐
└──▶ Hermes Profile: bob (127.0.0.1:8643, user: hermes-svc) ──┼──▶ Ollama (127.0.0.1:11434, user: ollama)
└─▶ Gemma 4 12B / 26B on RTX 5060 Ti (16GB)
The Final Technical Stack
| Layer | Specification |
|---|---|
| Inference Backend | Ollama (127.0.0.1:11434/v1, user: ollama) with Flash Attention & q8_0 KV Cache |
| Models | Gemma 4 12B (100% VRAM, up to 3 parallel slots) & Gemma 4 26B MoE |
| Agent Layer | Hermes Agent (hermes-profile@.service, 127.0.0.1:8642+, user: hermes-svc) |
| LAN Frontend | Open WebUI (LAN:3000, user: openwebui-svc) with Private per-user model ACLs |
| Orchestration | Idempotent Bash + systemd + uv (UV_NO_CONFIG=1) + UFW LAN firewall |
| Hardware Node | Asus B85M-E + 32GB DDR3 + NVIDIA RTX 5060 Ti (16GB VRAM) |
Lessons from Multi-User Hardening
- Cold-Start Latency Beats Peak Batch Throughput on 4 Cores: While vLLM excels in datacenter clusters, CPU-bound
torch.compileand FlashInfer JIT builds on a 4-core host added multi-minute startup delays—whereas Ollama's precompiled CUDA binaries start in seconds and expose the exact same/v1API Hermes expects. - Watch Working Directory Traversal Under
sudo -u: Switching to anologinservice user withsudo -u <user> -Hpreserves the caller'sPWD; settingUV_NO_CONFIG=1across PAM,sudoers, andsystemdalongsideenv -Cpreventsuvfrom hittingEACCESwhile probing restricted admin directories. - Evict VRAM Before Suspend: Unloading active weights via
keep_alive: 0in aBefore=sleep.targetunit frees all 16GB VRAM before sleep so the GPU wakes cleanly without broken CUDA contexts.
Moving Forward: Shared Home Lab Intelligence
With privilege-isolated agents, per-user memory, and automated VRAM budgeting running reproducibly from a single script, every user on the LAN now gets a private AI workspace backed by local hardware—with zero cloud dependencies and clean power management.