A lightweight HTTP server to remotely control a Synology NAS from your local network. Runs as a background daemon and provides a minimal web UI plus a JSON API for wake, shutdown, and status checks.
- Wake-on-LAN — send a magic packet to power on the NAS
- Shutdown — graceful shutdown via the Synology DSM API
- Status check — ICMP ping (with TCP fallback) to detect online/offline state
- Web UI — minimal single-page dashboard
- English & German — UI and API messages, selectable via config
- Daemon mode — runs in the background with start/stop commands
- Local-only access — requests from public IPs are rejected
go build -o nas-control .
./nas-control startThis starts the server as a background daemon on 0.0.0.0:7654 (default). Open http://<host>:7654 in your browser.
To stop the server:
./nas-control stopLog output is written to nas-control.log next to the binary.
nas-control [start|stop]
| Command | Description |
|---|---|
start |
Start the server as a background daemon (default if no argument given) |
stop |
Stop a running daemon |
Create a config.yaml in the working directory or next to the binary:
listen_addr: "0.0.0.0:7654"
language: "en"
nas:
url: "http://192.168.1.100:5000"
user: "nas-control"
pass: "your-password"
mac: "AA:BB:CC:DD:EE:FF"| Field | Description |
|---|---|
listen_addr |
Address and port the server listens on |
language |
UI and API message language: en (default) or de |
nas.url |
Base URL of the Synology DSM web interface |
nas.user |
DSM user for API access (see below) |
nas.pass |
Password for the DSM user |
nas.mac |
MAC address of the NAS (for Wake-on-LAN) |
If no config file is found, built-in defaults are used.
The web UI and the API response messages are available in English (en) and
German (de). Set language in config.yaml to switch:
language: "de"If language is omitted, empty, or set to an unsupported value, English is
used. Server log output stays English regardless of this setting, and the
/state message remains the machine-readable token online / offline.
The shutdown feature requires a dedicated DSM user. Do not use your main admin account — create a separate user without 2FA so the API login works.
- Open DSM > Control Panel > User & Group
- Click Create and pick a username (e.g.
nas-control) - Set a strong password
- Add the user to the administrators group (required for shutdown permissions)
- On the Permissions tab deny access to all shared folders — this user only needs API access
- Complete the wizard and make sure 2-Factor Authentication is not enabled for this user
Use this user's credentials in your config.yaml.
| Method | Path | Description |
|---|---|---|
| GET | / |
Web UI |
| GET | /info |
NAS connection info, MAC, version, language (JSON) |
| GET | /state |
Online/offline status (JSON) |
| POST | /on |
Send Wake-on-LAN magic packet |
| POST | /off |
Shut down via Synology DSM API |
| POST | /kill |
Kill the nas-control server process |
All endpoints return JSON:
{"status": "ok", "message": "Wake-on-LAN packet sent to AA:BB:CC:DD:EE:FF"}go test -v ./...The ICMP ping test requires raw socket privileges (root or CAP_NET_RAW) and is automatically skipped when running unprivileged.
- Synology DSM 7.2
