Browse Source

Run qbt-nox as non-root

This is mainly to avoid downloaded files being owned by root which
requires another one or two commands to change the file ownership.
adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
0e456f33c1
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 10
      dist/docker/Dockerfile
  2. 9
      dist/docker/entrypoint.sh

10
dist/docker/Dockerfile vendored

@ -40,9 +40,17 @@ FROM alpine:latest @@ -40,9 +40,17 @@ FROM alpine:latest
RUN \
apk --no-cache add \
doas \
libtorrent-rasterbar \
qt6-qtbase \
tini
tini && \
adduser \
-D \
-H \
-s /sbin/nologin \
-u 1000 \
qbtUser && \
echo "permit nopass :root" >> "/etc/doas.d/doas.conf"
COPY --from=builder /usr/local/bin/qbittorrent-nox /usr/bin/qbittorrent-nox

9
dist/docker/entrypoint.sh vendored

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
#!/bin/sh
downloadsPath="/downloads"
profilePath="/config"
qbtConfigFile="$profilePath/qBittorrent/config/qBittorrent.conf"
@ -22,7 +23,13 @@ EOF @@ -22,7 +23,13 @@ EOF
fi
fi
qbittorrent-nox \
# those are owned by root by default
# don't change existing files owner in `$downloadsPath`
chown qbtUser:qbtUser "$downloadsPath"
chown qbtUser:qbtUser -R "$profilePath"
doas -u qbtUser \
qbittorrent-nox \
--profile="$profilePath" \
--webui-port="$QBT_WEBUI_PORT" \
"$@"

Loading…
Cancel
Save