Skip to content

Repository files navigation

NAS Control

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.

Screenshot

NAS Control Web UI

Features

  • 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

Quick Start

go build -o nas-control .
./nas-control start

This 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 stop

Log output is written to nas-control.log next to the binary.

Usage

nas-control [start|stop]
Command Description
start Start the server as a background daemon (default if no argument given)
stop Stop a running daemon

Configuration

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.

Language

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.

DSM User Setup

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.

  1. Open DSM > Control Panel > User & Group
  2. Click Create and pick a username (e.g. nas-control)
  3. Set a strong password
  4. Add the user to the administrators group (required for shutdown permissions)
  5. On the Permissions tab deny access to all shared folders — this user only needs API access
  6. Complete the wizard and make sure 2-Factor Authentication is not enabled for this user

Use this user's credentials in your config.yaml.

API

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"}

Running Tests

go test -v ./...

The ICMP ping test requires raw socket privileges (root or CAP_NET_RAW) and is automatically skipped when running unprivileged.

Tested With

  • Synology DSM 7.2

About

Lightweight HTTP server to control a Synology NAS (WoL, shutdown, status)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages