mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-22 09:16:05 +03:00
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.
This commit is contained in:
parent
6778d36454
commit
0e456f33c1
2 changed files with 20 additions and 5 deletions
10
dist/docker/Dockerfile
vendored
10
dist/docker/Dockerfile
vendored
|
@ -40,9 +40,17 @@ FROM alpine:latest
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apk --no-cache add \
|
apk --no-cache add \
|
||||||
|
doas \
|
||||||
libtorrent-rasterbar \
|
libtorrent-rasterbar \
|
||||||
qt6-qtbase \
|
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
|
COPY --from=builder /usr/local/bin/qbittorrent-nox /usr/bin/qbittorrent-nox
|
||||||
|
|
||||||
|
|
15
dist/docker/entrypoint.sh
vendored
15
dist/docker/entrypoint.sh
vendored
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
downloadsPath="/downloads"
|
||||||
profilePath="/config"
|
profilePath="/config"
|
||||||
qbtConfigFile="$profilePath/qBittorrent/config/qBittorrent.conf"
|
qbtConfigFile="$profilePath/qBittorrent/config/qBittorrent.conf"
|
||||||
|
|
||||||
|
@ -22,7 +23,13 @@ EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
qbittorrent-nox \
|
# those are owned by root by default
|
||||||
--profile="$profilePath" \
|
# don't change existing files owner in `$downloadsPath`
|
||||||
--webui-port="$QBT_WEBUI_PORT" \
|
chown qbtUser:qbtUser "$downloadsPath"
|
||||||
"$@"
|
chown qbtUser:qbtUser -R "$profilePath"
|
||||||
|
|
||||||
|
doas -u qbtUser \
|
||||||
|
qbittorrent-nox \
|
||||||
|
--profile="$profilePath" \
|
||||||
|
--webui-port="$QBT_WEBUI_PORT" \
|
||||||
|
"$@"
|
||||||
|
|
Loading…
Reference in a new issue