Tutorials 9 min read

Connect Your NAS to a UPS in 2026 for Proper Shutdown with NUT

Connect a USB UPS to a Debian or Ubuntu NAS and configure NUT (nut.conf, ups.conf, upsd.users, upsmon.conf) for an automatic clean shutdown, with a risk-free test.

See our picks
S By Selfhostr Team · no sponsored content
Connect Your NAS to a UPS in 2026 for Proper Shutdown with NUT
ⓘ ⓘ This article may contain affiliate links (no extra cost to you, it funds the site). As an Amazon Associate, Selfhostr earns from qualifying purchases. See the disclosure.
⏱️
~45 min
Duration
🎚️
Intermediate
Difficulty
💶
0 € (free software)
Cost
📦
Docker installed and configured on the NAS
Key Prerequisites

👍 What we like

  • ✓Automatic, clean NAS shutdown when the UPS battery becomes critical.
  • ✓Free software, available in the Debian and Ubuntu repositories, with ready-made systemd services.
  • ✓A single driver, usbhid-ups, covers many USB UPS models (Eaton/MGE, some APC).
  • ✓Can also shut down other machines on the local network in secondary mode.

👎 What to watch

  • ✕Configuration is spread across four files, on the command line.
  • ✕By default, shutdown only happens at low battery: the threshold depends on what the UPS exposes.
  • ✕Some APC USB models need driver tweaks (pollinterval) to stay stable.
  • ✕Automatic power-on when mains returns also depends on the NAS BIOS/UEFI.

🏆 Our picks

Affiliate links · same price for you
Recommended
APC Back-UPS Pro BR1200SI

APC Back-UPS Pro BR1200SI

Voir sur Amazon

Amazon · price and availability on the listing

Alternative
Eaton Ellipse ECO 1600 USB

Eaton Ellipse ECO 1600 USB

Voir sur Amazon

Amazon · price and availability on the listing

See all our recommended gear in the shop.

📑 Contents ▾

When the power goes out, a NAS that dies abruptly can corrupt a file system, break a RAID rebuild or damage a database. A UPS gives you a few minutes of runtime. The NAS still has to know when to shut down cleanly. That is the job of NUT (Network UPS Tools). A driver reads the UPS status over USB, the upsd daemon publishes that data, and upsmon starts the system shutdown once the battery becomes critical.

This tutorial follows the method documented by the NUT project, on a NAS running Debian or Ubuntu (or a derivative such as OpenMediaVault), with the UPS connected over USB. NUT is installed directly on the host, not in Docker. The driver needs access to the USB device, and the shutdown order has to reach the system itself. For off-the-shelf NAS units (Synology, QNAP, TrueNAS), see the FAQ: their interface already includes NUT.

Prerequisites

  • A NAS running Debian 12 or 13, Ubuntu 24.04 LTS or another still-supported release, with sudo access. Ubuntu 23.10, for example, is end-of-life and its repositories are no longer served.
  • A UPS with a USB communication port that NUT recognises. The APC Back-UPS Pro BR1200SI and the Eaton Ellipse ECO 1600 USB both have a USB port. The expected driver is usbhid-ups, which the documentation describes as supporting Eaton/MGE USB models and some APC models. Confirm your exact model in the NUT compatibility list and with nut-scanner (step 3).
  • The USB cable supplied with the UPS, plugged into a USB port on the NAS.
  • The NAS plugged into a battery-backed outlet on the UPS, not a “surge only” outlet.
  • Console or SSH access from the local network only.

Step-by-step installation

Step 1: Install NUT

The nut package is a metapackage. It installs nut-server (the drivers, including usbhid-ups, and the upsd daemon) and nut-client (upsmon, upsc). The UPS is connected to the NAS over USB, so you need both.

sudo apt update
sudo apt install nut usbutils

Check: the installed version decides some keywords (see step 5).

dpkg -l nut-server nut-client | grep '^ii'

Debian 13 ships NUT 2.8.1 and Debian 12 ships the 2.8.x series. If your version is 2.7.x, note it for step 5.

Step 2: Set standalone mode (nut.conf)

By default, /etc/nut/nut.conf contains MODE=none and no NUT service starts. When the UPS is connected to the machine it protects, the mode is standalone.

sudo sed -i 's/^MODE=.*/MODE=standalone/' /etc/nut/nut.conf

Check:

grep '^MODE' /etc/nut/nut.conf
# Expected: MODE=standalone

If the line doesn’t show up, add MODE=standalone by hand with sudo nano /etc/nut/nut.conf.

Step 3: Detect the UPS and declare it (ups.conf)

A USB HID UPS does not show up as /dev/ttyUSB0. You identify it by its USB IDs. Unplug and replug the USB cable after installing, so that the udev rule shipped with NUT (62-nut-usbups.rules) applies the right permissions.

lsusb
sudo nut-scanner -U

lsusb should show an APC line (vendor ID 051d) or an Eaton/MGE line (0463). nut-scanner -U suggests a ready-made section with driver = "usbhid-ups". Then edit /etc/nut/ups.conf (NUT’s own INI format, not YAML):

sudo nano /etc/nut/ups.conf

Add at the end:

[br1200si]
    driver = usbhid-ups
    port = auto
    desc = "NAS UPS"

driver and port are mandatory. For USB the driver ignores the port value, but one must be present, so we use auto. With an Eaton you can name the section [ellipse]. Then use that name everywhere below. If several UPS units are connected, add vendorid = 051d (or 0463) and serial = "…" (value given by nut-scanner).

Start the driver. With NUT 2.8, nut-driver-enumerator creates a nut-driver@<name> service for each section:

sudo systemctl restart nut-driver-enumerator.service
sudo systemctl status nut-driver@br1200si.service --no-pager

Check: the service should be active (running). If the unit doesn’t exist (older versions), run sudo upsdrvctl start: the command should finish without errors.

Step 4: Start upsd and create the monitoring user (upsd.users)

In the default configuration, upsd only listens on loopback (port 3493). Keep it that way. Now create the user that upsmon will log in with. First generate a password:

openssl rand -hex 16
sudo nano /etc/nut/upsd.users
[upsmon_local]
    password = PASTE_THE_PASSWORD_HERE
    upsmon primary

primary means the system that has the UPS attached directly and can request a forced shutdown (FSD). On NUT 2.7.x the legacy keyword is upsmon master. Protect the file, then start the server:

sudo chown root:nut /etc/nut/upsd.users
sudo chmod 640 /etc/nut/upsd.users
sudo systemctl restart nut-server.service

Check: the UPS should answer, and upsd should only listen locally.

upsc br1200si@localhost ups.status
# Expected: OL (on mains), possibly "OL CHRG"
upsc br1200si@localhost battery.charge
sudo ss -tlnp | grep 3493
# Expected: 127.0.0.1:3493 and/or [::1]:3493, never 0.0.0.0

Step 5: Configure the clean shutdown (upsmon.conf)

No home-made script and no event.d folder: upsmon handles the shutdown. It watches the UPS and, once the UPS is on battery and low battery (OB LB), it sets the FSD flag, creates the POWERDOWNFLAG file, then runs SHUTDOWNCMD.

sudo nano /etc/nut/upsmon.conf

Add or adjust these lines. The other directives in the original file can stay, but none of them should appear twice.

MONITOR br1200si@localhost 1 upsmon_local PASTE_THE_PASSWORD_HERE primary
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POWERDOWNFLAG /etc/killpower
FINALDELAY 5
NOTIFYFLAG ONBATT SYSLOG+WALL
NOTIFYFLAG ONLINE SYSLOG+WALL
NOTIFYFLAG LOWBATT SYSLOG+WALL

Use the same username and password as in upsd.users. On NUT 2.7.x, replace primary with master. Protect the file (it contains the password), then start the monitor:

sudo chown root:nut /etc/nut/upsmon.conf
sudo chmod 640 /etc/nut/upsmon.conf
sudo systemctl enable --now nut-monitor.service
sudo systemctl restart nut-monitor.service

Check: list the directives that are actually active and the service status.

grep -Ev '^\s*(#|$)' /etc/nut/upsmon.conf
systemctl status nut-monitor.service --no-pager
sudo journalctl -u nut-monitor -n 20 --no-pager

The log should show neither Login on UPS … failed nor Data stale.

On Debian, nut-server also installs /usr/lib/systemd/system-shutdown/nutshutdown. At the very end of shutdown, if the POWERDOWNFLAG file exists, this script tells the UPS to cut and then restore its output. The NAS can then boot again when power returns, provided its BIOS/UEFI is set to “power on after AC loss”. Check this behaviour in the documentation for your version.

Verification checks

Risk-free test of the shutdown chain

upsmon -c fsd simulates a power failure: the command sets the FSD flag and really triggers SHUTDOWNCMD. The NUT documentation recommends running this test with a dummy command. Temporarily replace the SHUTDOWNCMD line with:

SHUTDOWNCMD "/usr/bin/logger -t nut-test SHUTDOWNCMD_triggered"

A change to SHUTDOWNCMD requires restarting upsmon (a reload is not enough):

sudo systemctl restart nut-monitor.service
sudo upsmon -c fsd
sleep 10
sudo journalctl -t nut-test --no-pager | tail -n 3

The SHUTDOWNCMD_triggered line should appear. Then clean up without fail. The FSD flag stays set until upsd restarts, and the /etc/killpower file would make the UPS cut power at the next shutdown.

sudo rm -f /etc/killpower
# Put SHUTDOWNCMD "/sbin/shutdown -h +0" back in upsmon.conf, then:
sudo systemctl restart nut-server.service nut-monitor.service
upsc br1200si@localhost ups.status   # should be OL again, without FSD

Real test

Warn your users, stop any important writes, then unplug the UPS from the wall (not the NAS from the UPS). upsc br1200si@localhost ups.status should switch to OB. By default, NUT waits for the low-battery state (LB) before shutting down. Depending on the load, that can take a while. To shut down earlier, upsrw br1200si@localhost lists your UPS’s writable variables, for example battery.charge.low if your model exposes it. This command is for changing variables, not for testing the shutdown.

Security and best practices

  • Keep upsd on loopback. For another LAN server to follow the same UPS (as secondary), add a LISTEN line in upsd.conf for the NAS’s local IP. Then filter port 3493 at the firewall so that only those machines can reach it. Never expose it to the Internet, any more than SSH or the NAS admin interface.
  • Passwords and permissions: one random password per NUT user, and /etc/nut/* files set to root:nut / 640.
  • Encryption: NUT does not use HTTPS. upsd has its own TLS configuration (CERTFILE and related options in upsd.conf). It only matters if clients connect over the network. See the documentation for your version.
  • Battery: a worn battery loses runtime without warning. Keep an eye on battery.charge and on replacement alerts (RB in ups.status).
  • Backups: a UPS is no substitute for an off-site backup.

Troubleshooting common errors

upsc returns “Driver not connected” or “Connection failure”

Cause: the driver didn’t start (badly written section in /etc/nut/ups.conf, USB permissions) or nut-server is stopped. Fix: read sudo journalctl -u nut-driver@br1200si -n 50, replug the USB cable to apply the udev rule, then restart nut-driver-enumerator and nut-server.

”Login on UPS [br1200si@localhost] failed – got [ACCESS-DENIED]”

Cause: the user or password in MONITOR doesn’t match upsd.users, or upsd wasn’t restarted. Fix: compare the two files, then sudo systemctl restart nut-server nut-monitor.

USB dropouts, “Data stale” (common on some APC Back-UPS)

Cause: some models stop responding at the default polling rate. Fix: the usbhid-ups documentation suggests adding pollinterval = 10 to the UPS section, then restarting the driver.

The NAS doesn’t shut down during a real outage

Cause: MODE=none, nut-monitor stopped, or the NAS plugged into an outlet without battery backup. Fix: check grep MODE /etc/nut/nut.conf and systemctl status nut-monitor, then run the dummy test again.

FAQ

Which UPS should I choose for this tutorial?

You need a model with a USB port that usbhid-ups supports. The APC Back-UPS Pro BR1200SI and the Eaton Ellipse ECO 1600 USB fit that description, but always check your exact model in the NUT compatibility list. Note that the Ellipse ECO is an “off-line” UPS (no voltage regulation), whereas the Back-UPS Pro is “line-interactive”.

Can NUT run in Docker?

The NUT project does not publish an official Docker image. A container would need the USB device and would also have to shut down the host, which complicates everything for no gain. Install NUT on the host and don’t run a second copy in a container.

What about Synology, QNAP or TrueNAS?

These systems include NUT in their power or UPS settings. Enable USB UPS support in their interface, following the vendor’s documentation. Don’t install packages by hand.

How do I shut down several machines with one UPS?

The NAS stays primary. The other machines install nut-client, set MODE=netclient in nut.conf and use a MONITOR br1200si@NAS_IP 1 user password secondary line, with an upsmon secondary user declared in upsd.users. All of this stays on the local network.

Read also

Host this yourself

No hardware to manage? This kind of service runs on a managed VPS, ready in minutes. See PlanetHoster plans

Tags: nasupsnut2026

Related

Tutorials

Metal Rack Assembly for Home Lab 2026: Step-by-Step Guide

Discover our comprehensive and detailed tutorial to install a metal rack in 2026. Follow our practical tips, complete configuration files, and exact commands.

Read
Tutorials

Make Your NAS Quiet in 2026: Step-by-Step Guide

Quiet down a Synology DS923+: DSM fan modes, HDD hibernation, vibration damping, then optional replacement of the two 92 mm fans, with its limits (warranty, fan failure alert).

Read
Tutorials

Recycle an Old PC into a Home Server in 2026

Turn an old PC into a home server in 2026: Ubuntu Server LTS, official Docker, Nextcloud with MariaDB and Caddy for automatic HTTPS, plus a firewall and backups.

Read