{"article":{"slug":"configure-a-ups-on-linux-with-nut","title":"Configure a UPS on Linux with NUT","subtitle":null,"summary":"A step-by-step guide to installing Network UPS Tools (NUT) on Debian, Fedora/RHEL and Arch, detecting a USB UPS with nut-scanner, configuring ups.conf, upsd and upsmon, and triggering a safe automatic shutdown before the battery runs out.","content_type":"tutorial","language":"en","canonical_url":"https://linuxjunkies.org/guides/configure-a-ups-with-nut","author":{"name":"Linux Junkies","url":null,"person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"Linux Junkies","url":"https://linuxjunkies.org/","listing_slug":null,"listing":null},"topics":[{"name":"linux","slug":"linux","url":"https://listedarticles.com/topics/linux"},{"name":"sysadmin","slug":"sysadmin","url":"https://listedarticles.com/topics/sysadmin"},{"name":"hardware","slug":"hardware","url":"https://listedarticles.com/topics/hardware"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":1058,"reading_minutes":5,"published_at":"2026-05-25T22:11:52.000Z","added_at":"2026-10-31T08:15:03.428Z","updated_at":"2026-10-31T08:15:03.428Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/configure-a-ups-on-linux-with-nut","markdown_url":"https://listedarticles.com/articles/configure-a-ups-on-linux-with-nut.md","example":false,"citation":"Linux Junkies, Linux Junkies. \"Configure a UPS on Linux with NUT.\" 25 May 2026. https://linuxjunkies.org/guides/configure-a-ups-with-nut (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://linuxjunkies.org/guides/configure-a-ups-with-nut"},"body_markdown":"# Configure a UPS on Linux with NUT\n\nA UPS (Uninterruptible Power Supply) protects servers and workstations from sudden power loss, but hardware alone is not enough. Without software monitoring the UPS, your system will still crash hard when the battery runs out. Network UPS Tools (NUT) is the standard open-source solution: it speaks to hundreds of UPS models, monitors battery state, and triggers a clean shutdown before the battery dies. This guide walks through a single-machine NUT setup — one host talking directly to its own UPS — the most common scenario for a home lab or small server.\n\n## Prerequisites and Terminology\n\nNUT has three moving parts you need to understand before touching config files:\n\n- **upsd** — the daemon that reads UPS data and serves it over a socket\n- **upsmon** — monitors UPS state and triggers shutdown commands\n- **driver** — the per-model binary that actually talks to the UPS hardware (USB, serial, SNMP, etc.)\n\nFor a single machine, all three run on the same host. The UPS connects via USB (most common for consumer and prosumer units) or a serial port.\n\n## Install NUT\n\n### Debian / Ubuntu\n\n```\nsudo apt update\nsudo apt install nut nut-client nut-server\n```\n\n### Fedora / RHEL 9 / Rocky Linux\n\n```\nsudo dnf install nut\n```\n\nOn RHEL-family systems the package ships both server and client components together.\n\n### Arch Linux\n\n```\nsudo pacman -S nut\n```\n\nAfter installation NUT's config files live in `/etc/nut/` on all distributions.\n\n## Detect Your UPS\n\nPlug in the UPS via USB, then run the scanner. It probes USB and other buses and prints the driver block you need:\n\n```\nsudo nut-scanner -U\n```\n\nOutput will look roughly like this (yours will differ):\n\n```\n[nutdev1]\n    driver = \"usbhid-ups\"\n    port   = \"auto\"\n    vendorid = \"051d\"\n    productid = \"0002\"\n    product  = \"Back-UPS ES 700\"\n    vendor   = \"American Power Conversion\"\n```\n\nCopy this block — you will paste most of it into `ups.conf`. If `nut-scanner` finds nothing, check that the USB cable is data-capable (not charge-only) and that you ran the command with `sudo`.\n\n## Configure the Driver — ups.conf\n\nEdit `/etc/nut/ups.conf`. Replace any placeholder content with your detected block, giving the UPS a short name (here, `myups`):\n\n```\nsudo nano /etc/nut/ups.conf\n```\n\n```\n[myups]\n    driver = usbhid-ups\n    port   = auto\n    desc   = \"APC Back-UPS ES 700\"\n```\n\nIf `nut-scanner` returned `vendorid` and `productid`, add them too — they prevent NUT from grabbing the wrong USB device if you ever connect multiple UPS units.\n\n```\n[myups]\n    driver    = usbhid-ups\n    port      = auto\n    vendorid  = 051d\n    productid = 0002\n    desc      = \"APC Back-UPS ES 700\"\n```\n\nCommon drivers: `usbhid-ups` covers most USB HID-compliant units (APC, Eaton, CyberPower); `blazer_usb` covers many cheaper USB units from Mecer, Voltronic, and rebrands; `nutdrv_qx` covers Q-series protocol units. The NUT hardware compatibility list at [networkupstools.org](https://www.networkupstools.org/stable-hcl.html) maps models to drivers.\n\n## Set the Operating Mode — nut.conf\n\nThis single file tells NUT what role this machine plays:\n\n```\nsudo nano /etc/nut/nut.conf\n```\n\n```\nMODE=standalone\n```\n\n`standalone` means one machine, one UPS, no network slaves. Use `netserver` only if other machines will monitor this UPS over the network.\n\n## Configure the Server — upsd.conf and upsd.users\n\n`upsd.conf` controls what interfaces `upsd` listens on. For a standalone setup, localhost is sufficient:\n\n```\nsudo nano /etc/nut/upsd.conf\n```\n\n```\nLISTEN 127.0.0.1 3493\nLISTEN ::1 3493\n```\n\nThen define at least one user in `upsd.users`. You need an `admin`-type user for `upsmon` to authenticate with:\n\n```\nsudo nano /etc/nut/upsd.users\n```\n\n```\n[upsmon_local]\n    password  = changeme_strong_password\n    upsmon master\n```\n\nPick a real password. Even though this only listens on localhost, it is still a credential stored in a plain-text file — restrict its permissions:\n\n```\nsudo chmod 640 /etc/nut/upsd.users\nsudo chown root:nut /etc/nut/upsd.users\n```\n\n## Configure the Monitor — upsmon.conf\n\n`upsmon` is what actually calls `shutdown` when the battery hits a critical level:\n\n```\nsudo nano /etc/nut/upsmon.conf\n```\n\nThe critical line is `MONITOR`. Its format is `upsname@host powervalue username password type`:\n\n```\nMONITOR myups@localhost 1 upsmon_local changeme_strong_password master\n\nMINSUPPLIES 1\nSHUTDOWNCMD \"/sbin/shutdown -h +0\"\nNOTIFYFLAG ONLINE  SYSLOG+WALL\nNOTIFYFLAG ONBATT  SYSLOG+WALL\nNOTIFYFLAG LOWBATT SYSLOG+WALL\nNOTIFYFLAG COMMOK  SYSLOG\nNOTIFYFLAG COMMBAD SYSLOG\nPOLLFREQ 5\nPOLLFREQALERT 5\nHOSTSYNC 15\nDEADTIME 25\nRBWARNTIME 43200\nNOCOMMWARNTIME 300\nFINALDELAY 5\n```\n\n`SHUTDOWNCMD` is what runs when the battery is critically low. `/sbin/shutdown -h +0` halts immediately. Adjust to `shutdown -h +2` if you want a two-minute grace window. The `powervalue 1` means this host needs 1 power supply from this UPS to stay alive — correct for a standard desktop or server.\n\n## Start and Enable the Services\n\n### Debian / Ubuntu / Arch\n\n```\nsudo systemctl enable --now nut-server nut-monitor\n```\n\nOn Debian/Ubuntu you may also need:\n\n```\nsudo systemctl enable --now nut-driver@myups\n```\n\n### Fedora / RHEL / Rocky\n\n```\nsudo systemctl enable --now ups nut-server nut-monitor\n```\n\nThe RHEL family uses a `ups` target that groups the driver and server. If the service name differs on your release, use `systemctl list-units 'nut*'` to see what is available.\n\n## Verify Everything is Working\n\nQuery live UPS data with `upsc`:\n\n```\nupsc myups@localhost\n```\n\nYou should see a wall of variables — the important ones:\n\n- `ups.status: OL` — Online (on mains power)\n- `battery.charge: 100` — Battery fully charged\n- `battery.runtime: 1800` — Estimated runtime in seconds\n\n`OB` means on battery, `LB` means low battery (shutdown imminent). Check that `upsmon` is connected:\n\n```\nsudo upsc myups@localhost ups.status\nsudo systemctl status nut-monitor\n```\n\nTo test driver communication without triggering a real shutdown, briefly unplug the UPS mains cable and watch the status flip to `OB` in the output of a looping `upsc`:\n\n```\nwatch -n 2 upsc myups@localhost ups.status\n```\n\n## Troubleshooting\n\n### Driver fails to start — permission denied on USB device\n\nThe `nut` user needs access to the USB device node. On most distros the NUT package ships a udev rule at `/lib/udev/rules.d/62-nut-usbups.rules` that handles this. If it is missing, reload udev and replug the UPS:\n\n```\nsudo udevadm control --reload-rules\nsudo udevadm trigger\n```\n\n### upsc returns \"Error: Driver not connected\"\n\nThe driver has not started or crashed. Check its journal:\n\n```\nsudo journalctl -u nut-driver@myups -n 50\n```\n\nCommon causes: wrong `driver =` value in `ups.conf`, typo in the UPS name, or a USB permission issue.\n\n### upsmon reports \"COMMBAD\" then does nothing\n\nIf `upsd` is not reachable, `upsmon` logs `COMMBAD` but will not shut down until `DEADTIME` seconds have elapsed. Check that `nut-server` is running and that the credentials in `upsmon.conf` match `upsd.users` exactly — including case.\n\n### System shuts down immediately after config\n\nCheck that `MINSUPPLIES` is set to `1` and that `upsc myups@localhost ups.status` shows `OL` before starting services. If NUT cannot reach the UPS at startup it may treat it as a lost supply and trigger shutdown.\n","body_html":"<h1 id=\"configure-a-ups-on-linux-with-nut\">Configure a UPS on Linux with NUT</h1>\n<p>A UPS (Uninterruptible Power Supply) protects servers and workstations from sudden power loss, but hardware alone is not enough. Without software monitoring the UPS, your system will still crash hard when the battery runs out. Network UPS Tools (NUT) is the standard open-source solution: it speaks to hundreds of UPS models, monitors battery state, and triggers a clean shutdown before the battery dies. This guide walks through a single-machine NUT setup — one host talking directly to its own UPS — the most common scenario for a home lab or small server.</p>\n<h2 id=\"prerequisites-and-terminology\">Prerequisites and Terminology</h2>\n<p>NUT has three moving parts you need to understand before touching config files:</p>\n<ul><li><strong>upsd</strong> — the daemon that reads UPS data and serves it over a socket</li><li><strong>upsmon</strong> — monitors UPS state and triggers shutdown commands</li><li><strong>driver</strong> — the per-model binary that actually talks to the UPS hardware (USB, serial, SNMP, etc.)</li></ul>\n<p>For a single machine, all three run on the same host. The UPS connects via USB (most common for consumer and prosumer units) or a serial port.</p>\n<h2 id=\"install-nut\">Install NUT</h2>\n<h3 id=\"debian-ubuntu\">Debian / Ubuntu</h3>\n<pre><code>sudo apt update\nsudo apt install nut nut-client nut-server</code></pre>\n<h3 id=\"fedora-rhel-9-rocky-linux\">Fedora / RHEL 9 / Rocky Linux</h3>\n<pre><code>sudo dnf install nut</code></pre>\n<p>On RHEL-family systems the package ships both server and client components together.</p>\n<h3 id=\"arch-linux\">Arch Linux</h3>\n<pre><code>sudo pacman -S nut</code></pre>\n<p>After installation NUT&#39;s config files live in <code>/etc/nut/</code> on all distributions.</p>\n<h2 id=\"detect-your-ups\">Detect Your UPS</h2>\n<p>Plug in the UPS via USB, then run the scanner. It probes USB and other buses and prints the driver block you need:</p>\n<pre><code>sudo nut-scanner -U</code></pre>\n<p>Output will look roughly like this (yours will differ):</p>\n<pre><code>[nutdev1]\n    driver = &quot;usbhid-ups&quot;\n    port   = &quot;auto&quot;\n    vendorid = &quot;051d&quot;\n    productid = &quot;0002&quot;\n    product  = &quot;Back-UPS ES 700&quot;\n    vendor   = &quot;American Power Conversion&quot;</code></pre>\n<p>Copy this block — you will paste most of it into <code>ups.conf</code>. If <code>nut-scanner</code> finds nothing, check that the USB cable is data-capable (not charge-only) and that you ran the command with <code>sudo</code>.</p>\n<h2 id=\"configure-the-driver-ups-conf\">Configure the Driver — ups.conf</h2>\n<p>Edit <code>/etc/nut/ups.conf</code>. Replace any placeholder content with your detected block, giving the UPS a short name (here, <code>myups</code>):</p>\n<pre><code>sudo nano /etc/nut/ups.conf</code></pre>\n<pre><code>[myups]\n    driver = usbhid-ups\n    port   = auto\n    desc   = &quot;APC Back-UPS ES 700&quot;</code></pre>\n<p>If <code>nut-scanner</code> returned <code>vendorid</code> and <code>productid</code>, add them too — they prevent NUT from grabbing the wrong USB device if you ever connect multiple UPS units.</p>\n<pre><code>[myups]\n    driver    = usbhid-ups\n    port      = auto\n    vendorid  = 051d\n    productid = 0002\n    desc      = &quot;APC Back-UPS ES 700&quot;</code></pre>\n<p>Common drivers: <code>usbhid-ups</code> covers most USB HID-compliant units (APC, Eaton, CyberPower); <code>blazer_usb</code> covers many cheaper USB units from Mecer, Voltronic, and rebrands; <code>nutdrv_qx</code> covers Q-series protocol units. The NUT hardware compatibility list at <a href=\"https://www.networkupstools.org/stable-hcl.html\" rel=\"nofollow ugc noopener\">networkupstools.org</a> maps models to drivers.</p>\n<h2 id=\"set-the-operating-mode-nut-conf\">Set the Operating Mode — nut.conf</h2>\n<p>This single file tells NUT what role this machine plays:</p>\n<pre><code>sudo nano /etc/nut/nut.conf</code></pre>\n<pre><code>MODE=standalone</code></pre>\n<p><code>standalone</code> means one machine, one UPS, no network slaves. Use <code>netserver</code> only if other machines will monitor this UPS over the network.</p>\n<h2 id=\"configure-the-server-upsd-conf-and-upsd-users\">Configure the Server — upsd.conf and upsd.users</h2>\n<p><code>upsd.conf</code> controls what interfaces <code>upsd</code> listens on. For a standalone setup, localhost is sufficient:</p>\n<pre><code>sudo nano /etc/nut/upsd.conf</code></pre>\n<pre><code>LISTEN 127.0.0.1 3493\nLISTEN ::1 3493</code></pre>\n<p>Then define at least one user in <code>upsd.users</code>. You need an <code>admin</code>-type user for <code>upsmon</code> to authenticate with:</p>\n<pre><code>sudo nano /etc/nut/upsd.users</code></pre>\n<pre><code>[upsmon_local]\n    password  = changeme_strong_password\n    upsmon master</code></pre>\n<p>Pick a real password. Even though this only listens on localhost, it is still a credential stored in a plain-text file — restrict its permissions:</p>\n<pre><code>sudo chmod 640 /etc/nut/upsd.users\nsudo chown root:nut /etc/nut/upsd.users</code></pre>\n<h2 id=\"configure-the-monitor-upsmon-conf\">Configure the Monitor — upsmon.conf</h2>\n<p><code>upsmon</code> is what actually calls <code>shutdown</code> when the battery hits a critical level:</p>\n<pre><code>sudo nano /etc/nut/upsmon.conf</code></pre>\n<p>The critical line is <code>MONITOR</code>. Its format is <code>upsname@host powervalue username password type</code>:</p>\n<pre><code>MONITOR myups@localhost 1 upsmon_local changeme_strong_password master\n\nMINSUPPLIES 1\nSHUTDOWNCMD &quot;/sbin/shutdown -h +0&quot;\nNOTIFYFLAG ONLINE  SYSLOG+WALL\nNOTIFYFLAG ONBATT  SYSLOG+WALL\nNOTIFYFLAG LOWBATT SYSLOG+WALL\nNOTIFYFLAG COMMOK  SYSLOG\nNOTIFYFLAG COMMBAD SYSLOG\nPOLLFREQ 5\nPOLLFREQALERT 5\nHOSTSYNC 15\nDEADTIME 25\nRBWARNTIME 43200\nNOCOMMWARNTIME 300\nFINALDELAY 5</code></pre>\n<p><code>SHUTDOWNCMD</code> is what runs when the battery is critically low. <code>/sbin/shutdown -h +0</code> halts immediately. Adjust to <code>shutdown -h +2</code> if you want a two-minute grace window. The <code>powervalue 1</code> means this host needs 1 power supply from this UPS to stay alive — correct for a standard desktop or server.</p>\n<h2 id=\"start-and-enable-the-services\">Start and Enable the Services</h2>\n<h3 id=\"debian-ubuntu-arch\">Debian / Ubuntu / Arch</h3>\n<pre><code>sudo systemctl enable --now nut-server nut-monitor</code></pre>\n<p>On Debian/Ubuntu you may also need:</p>\n<pre><code>sudo systemctl enable --now nut-driver@myups</code></pre>\n<h3 id=\"fedora-rhel-rocky\">Fedora / RHEL / Rocky</h3>\n<pre><code>sudo systemctl enable --now ups nut-server nut-monitor</code></pre>\n<p>The RHEL family uses a <code>ups</code> target that groups the driver and server. If the service name differs on your release, use <code>systemctl list-units &#39;nut*&#39;</code> to see what is available.</p>\n<h2 id=\"verify-everything-is-working\">Verify Everything is Working</h2>\n<p>Query live UPS data with <code>upsc</code>:</p>\n<pre><code>upsc myups@localhost</code></pre>\n<p>You should see a wall of variables — the important ones:</p>\n<ul><li><code>ups.status: OL</code> — Online (on mains power)</li><li><code>battery.charge: 100</code> — Battery fully charged</li><li><code>battery.runtime: 1800</code> — Estimated runtime in seconds</li></ul>\n<p><code>OB</code> means on battery, <code>LB</code> means low battery (shutdown imminent). Check that <code>upsmon</code> is connected:</p>\n<pre><code>sudo upsc myups@localhost ups.status\nsudo systemctl status nut-monitor</code></pre>\n<p>To test driver communication without triggering a real shutdown, briefly unplug the UPS mains cable and watch the status flip to <code>OB</code> in the output of a looping <code>upsc</code>:</p>\n<pre><code>watch -n 2 upsc myups@localhost ups.status</code></pre>\n<h2 id=\"troubleshooting\">Troubleshooting</h2>\n<h3 id=\"driver-fails-to-start-permission-denied-on-usb-device\">Driver fails to start — permission denied on USB device</h3>\n<p>The <code>nut</code> user needs access to the USB device node. On most distros the NUT package ships a udev rule at <code>/lib/udev/rules.d/62-nut-usbups.rules</code> that handles this. If it is missing, reload udev and replug the UPS:</p>\n<pre><code>sudo udevadm control --reload-rules\nsudo udevadm trigger</code></pre>\n<h3 id=\"upsc-returns-error-driver-not-connected\">upsc returns &quot;Error: Driver not connected&quot;</h3>\n<p>The driver has not started or crashed. Check its journal:</p>\n<pre><code>sudo journalctl -u nut-driver@myups -n 50</code></pre>\n<p>Common causes: wrong <code>driver =</code> value in <code>ups.conf</code>, typo in the UPS name, or a USB permission issue.</p>\n<h3 id=\"upsmon-reports-commbad-then-does-nothing\">upsmon reports &quot;COMMBAD&quot; then does nothing</h3>\n<p>If <code>upsd</code> is not reachable, <code>upsmon</code> logs <code>COMMBAD</code> but will not shut down until <code>DEADTIME</code> seconds have elapsed. Check that <code>nut-server</code> is running and that the credentials in <code>upsmon.conf</code> match <code>upsd.users</code> exactly — including case.</p>\n<h3 id=\"system-shuts-down-immediately-after-config\">System shuts down immediately after config</h3>\n<p>Check that <code>MINSUPPLIES</code> is set to <code>1</code> and that <code>upsc myups@localhost ups.status</code> shows <code>OL</code> before starting services. If NUT cannot reach the UPS at startup it may treat it as a lost supply and trigger shutdown.</p>","headings":[{"level":1,"text":"Configure a UPS on Linux with NUT","id":"configure-a-ups-on-linux-with-nut"},{"level":2,"text":"Prerequisites and Terminology","id":"prerequisites-and-terminology"},{"level":2,"text":"Install NUT","id":"install-nut"},{"level":3,"text":"Debian / Ubuntu","id":"debian-ubuntu"},{"level":3,"text":"Fedora / RHEL 9 / Rocky Linux","id":"fedora-rhel-9-rocky-linux"},{"level":3,"text":"Arch Linux","id":"arch-linux"},{"level":2,"text":"Detect Your UPS","id":"detect-your-ups"},{"level":2,"text":"Configure the Driver — ups.conf","id":"configure-the-driver-ups-conf"},{"level":2,"text":"Set the Operating Mode — nut.conf","id":"set-the-operating-mode-nut-conf"},{"level":2,"text":"Configure the Server — upsd.conf and upsd.users","id":"configure-the-server-upsd-conf-and-upsd-users"},{"level":2,"text":"Configure the Monitor — upsmon.conf","id":"configure-the-monitor-upsmon-conf"},{"level":2,"text":"Start and Enable the Services","id":"start-and-enable-the-services"},{"level":3,"text":"Debian / Ubuntu / Arch","id":"debian-ubuntu-arch"},{"level":3,"text":"Fedora / RHEL / Rocky","id":"fedora-rhel-rocky"},{"level":2,"text":"Verify Everything is Working","id":"verify-everything-is-working"},{"level":2,"text":"Troubleshooting","id":"troubleshooting"},{"level":3,"text":"Driver fails to start — permission denied on USB device","id":"driver-fails-to-start-permission-denied-on-usb-device"},{"level":3,"text":"upsc returns \"Error: Driver not connected\"","id":"upsc-returns-error-driver-not-connected"},{"level":3,"text":"upsmon reports \"COMMBAD\" then does nothing","id":"upsmon-reports-commbad-then-does-nothing"},{"level":3,"text":"System shuts down immediately after config","id":"system-shuts-down-immediately-after-config"}]}}