Execute commands on the host machine from inside this container.
bash
# Execute a command on the host
hostlink exec "ls /home/jebadiah"
# Ping the daemon (connection test)
hostlink ping
# With explicit socket/token (if env vars not set)
hostlink -s /run/hostlink/hostlink.sock -k $HOSTLINK_TOKEN exec "echo hello"
# Set working directory
hostlink -w /home/jebadiah exec "pwd"
# Set environment variables
hostlink -e MY_VAR=value exec "echo $MY_VAR"
# With timeout (ms)
hostlink -T 60000 exec "long-running-command"
# JSON output (machine-readable)
hostlink -j exec "ls -la" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['stdout'])"
# List configured targets
hostlink targets
Set these so you don't need to pass flags every time:
VariablePurposeDefaultHOSTLINK_SOCKETUnix socket path/run/hostlink/hostlink.sock``HOSTLINK_TOKENAuth token(required)HOSTLINK_TARGETTarget node name(optional)
Best place to set these: workspace/.env or openclaw.json env.vars section.
Check if hostlinkd is reachable:
bash
hostlink ping
# Expected: [hostname] pong - uptime Xs
# If error: daemon not running or socket not mounted
bash
hostlink exec "ls /home/jebadiah/projects"
hostlink exec "cat /etc/hostname"
bash
hostlink exec "nvidia-smi"
hostlink exec "ollama list"
hostlink exec "ls ~/.cache/huggingface/hub"
bash
hostlink exec "ls /path/to/qwen3-merge"
hostlink exec "cat /path/to/qwen3-merge/README.md"
bash
hostlink exec "docker ps"
hostlink exec "docker stats --no-stream"
CodeMeaning0Success1Remote command failed (check exit_code in JSON output)2Connection failed (daemon unreachable)3Authentication failed (wrong token)5Timeout7Client error (bad args, missing targets file)
"Connection failed" / exit 2:
sudo systemctl start hostlinkdHOSTLINK_SOCKET env var"Authentication failed" / exit 3:
HOSTLINK_TOKEN — must match auth_token in /etc/hostlink/hostlink.conf"server busy" error:
text
Container (you are here) Host machine
┌─────────────────────┐ ┌──────────────────────────┐
│ hostlink (client) │◄────────►│ hostlinkd (daemon) │
│ workspace/bin/ │ Unix │ /etc/hostlink/ │
│ │ socket │ auth_token = <secret> │
└─────────────────────┘ │ shell = /bin/bash │
└──────────────────────────┘
See references/setup.md for installation and docker-compose configuration.