Tutorials 12 min read

Connect Your NAS to a UPS in 2026 for Proper Shutdown with NUT (and Which UPS to Choose)

Choose a NUT-compatible USB UPS, connect it 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.

S By Selfhostr · no sponsored content
Connect Your NAS to a UPS in 2026 for Proper Shutdown with NUT (and Which UPS to Choose)
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.

👍 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.
📑 Contents ▾

For a Linux NAS to shut down cleanly during an outage, you need a UPS connected over USB and NUT (Network UPS Tools) installed on the NAS itself. On the hardware side, pick a model with a USB port supported by the usbhid-ups driver, such as the APC Back-UPS Pro BR1200SI or the Eaton Ellipse ECO 1600 USB, and confirm your exact model in the NUT compatibility list. On the software side, four files are enough: nut.conf, ups.conf, upsd.users and upsmon.conf, covered step by step below; choosing the UPS is discussed after the tutorial.

When the power goes out, a NAS that dies abruptly can corrupt a file system, break a RAID rebuild or damage a database. The UPS gives you a few minutes of runtime, and NUT tells the NAS when to shut down: 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 recognizes. 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 models mentioned in this guide are compared further down.
  • 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); another brand shows its own ID. nut-scanner -U suggests a ready-made section with the right driver (driver = "usbhid-ups" for these two brands). 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 behavior 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.

Choosing a NUT-compatible UPS

NUT does not need a high-end UPS, it needs one it can read. Four points matter for a Linux NAS:

  • The USB port and the driver. The model must have a USB communication port and appear in the NUT compatibility list, ideally with the usbhid-ups driver. A USB charging socket is not enough. If nut-scanner -U finds nothing, check the cable and the USB port before touching the configuration.
  • The topology. A “line-interactive” UPS regulates voltage without switching to battery at every dip in the mains; an “off-line” UPS switches straight to battery and does not regulate voltage. For a home NAS, both work; our line-interactive vs online comparison covers the differences.
  • Battery-backed outlets. Only the outlets connected to the battery keep the NAS running. Some models also have “surge only” outlets, which do nothing during an outage. Count the NAS, the router and the switch if you want to keep network access during the shutdown.
  • Power. A NAS draws little compared with these UPS units: the Synology DS224+ spec sheet lists 14.69 W in access mode, the QNAP TS-673A (6 bays, drives installed) 45.9 W. The headroom mainly serves runtime and the other devices plugged in. Our guide to sizing your UPS explains the calculation in VA and W.

The spec sheets of the four models below list no extension battery: runtime depends on the connected load. The Back-UPS Pro units and the CyberPower have a non-touch LCD screen, the Eaton makes do with indicator lights.

  • APC Back-UPS Pro BR1200SI (the model used in this tutorial): line-interactive, 1200 VA / 720 W, 8 IEC C13 outlets (the spec sheet does not say how many are battery-backed: check before plugging in the NAS), 24 V 9.0 Ah battery recharged in 16 h, 509 J surge energy rating, 45 dBA, 11.7 kg, tower format not rack-mountable, according to the APC spec sheet. It shows up in lsusb under ID 051d. See the APC Back-UPS Pro BR1200SI on Amazon.
  • APC Back-UPS Pro BR1600SI: the more powerful version, 1600 VA / 960 W, line-interactive, 24 V 9.4 Ah battery. Watch the outlet split: 6 battery-backed IEC C13 outlets and 2 surge-only C13 outlets. It belongs to the same Back-UPS Pro range as the BR1200SI; its support by usbhid-ups needs to be confirmed in the NUT compatibility list and with nut-scanner -U, as for the CyberPower. See the APC Back-UPS Pro BR1600SI on Amazon.
  • Eaton Ellipse ECO 1600 USB: 1600 VA, off-line, no voltage regulation, with a USB port supported by usbhid-ups on the Eaton/MGE side (ID 0463). Name its section [ellipse] in ups.conf. See the Eaton Ellipse ECO 1600 USB on Amazon.
  • CyberPower CP1500EPFCLCD: line-interactive, 1.5 kVA / 900 W and 6 outlets according to its spec sheet, with an LCD screen. Its NUT support and the driver to use need to be confirmed in the compatibility list and with nut-scanner -U before buying. See the CyberPower CP1500EPFCLCD on Amazon.

For a 19-inch rack or a busier homelab, our comparison of UPS units for servers also covers rack-mountable models.

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

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. To choose the NAS itself, see our 2026 NAS comparison.

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.

Key facts

~45 min
Duration
Intermediate
Difficulty
0 € (free software)
Software cost
UPS with a USB port, NAS running Debian or Ubuntu with sudo access
Key prerequisite

Our picks

Affiliate links · same price for you
Model used in this tutorial
APC Back-UPS Pro BR1200SI

APC Back-UPS Pro BR1200SI

View on Amazon

Amazon · price and availability on the listing

Off-line alternative
Eaton Ellipse ECO 1600 USB

Eaton Ellipse ECO 1600 USB

View on Amazon

Amazon · price and availability on the listing

1600 VA / 960 W, line-interactive
APC Back-UPS Pro BR1600SI

APC Back-UPS Pro BR1600SI

View on Amazon

Amazon · price and availability on the listing

1500 VA / 900 W, LCD screen
CyberPower CP1500EPFCLCD

CyberPower CP1500EPFCLCD

View on Amazon

Amazon · price and availability on the listing

See all our recommended gear in the shop.

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: Settings, Fans and a NAS for the Living Room or Bedroom

Quiet down a Synology DS923+: DSM fan modes, HDD hibernation, vibration damping, then optional replacement of the two 92 mm fans and its limits. Plus what to look for before buying a NAS for a living room or bedroom.

Read
Tutorials

Configure a ZFS cache on your NAS to boost performance in 2026

Optimize your TrueNAS or Proxmox NAS with a ZFS cache (ARC, L2ARC, ZIL) for faster reads and writes while maintaining the reliability of mechanical drives

Read