This note records a qbittorrent-nox setup for a VPS.
Example values:
- service user:
qbittorrent - config home:
/var/lib/qbittorrent - download directory:
/data/downloads - Web UI port:
18080 - BT listen port:
45000
Caddy reverse proxy is covered in the separate Caddy note. This article only covers qBittorrent itself.
Install
sudo apt install qbittorrent-noxOn Arch Linux:
sudo pacman -S qbittorrent-noxDo Not Run It As Root
Running a network-facing P2P daemon as root is asking for pain. If qBittorrent ever has an RCE or a bad plugin/script interaction, root turns that bug into full machine compromise.
Create a dedicated user:
sudo useradd -r -m -d /var/lib/qbittorrent -s /usr/sbin/nologin qbittorrentsudo mkdir -p /data/downloadssudo chown -R qbittorrent:qbittorrent /data/downloadssystemd Unit
Create /etc/systemd/system/qbittorrent-nox.service:
[Unit]Description=qBittorrent-nox serviceDocumentation=man:qbittorrent-nox(1)Wants=network-online.targetAfter=network-online.target nss-lookup.target
[Service]Type=simpleUser=qbittorrentGroup=qbittorrentExecStart=/usr/bin/qbittorrent-nox --profile=/var/lib/qbittorrent --webui-port=18080TimeoutStopSec=1800Restart=on-failure
ProtectSystem=fullProtectHome=trueNoNewPrivileges=true
[Install]WantedBy=multi-user.targetEnable it:
sudo systemctl daemon-reloadsudo systemctl enable --now qbittorrent-noxsudo systemctl status qbittorrent-noxWeb UI Binding
Stop the service before editing the config, otherwise qBittorrent may overwrite your changes:
sudo systemctl stop qbittorrent-noxsudo find /var/lib/qbittorrent -name "qBittorrent.conf"Edit the config file, usually under:
/var/lib/qbittorrent/qBittorrent/config/qBittorrent.confForce the Web UI to localhost:
[Preferences]WebUI\Address=127.0.0.1WebUI\Port=18080WebUI\HostHeaderValidation=trueKeep Host header validation enabled. If the reverse proxy preserves a public Host header, add only your actual UI hostname to the allowed server domains in your installed version’s Web UI settings (the config key is commonly WebUI\ServerDomains). Check the version’s UI/documentation rather than disabling validation or using a wildcard. Localhost binding alone is not a replacement for Host checks.
Start it again:
sudo systemctl start qbittorrent-noxOn recent qBittorrent versions, the initial random password may appear in logs:
journalctl -u qbittorrent-nox -e | grep -i passwordChange it immediately after logging in.