mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 07:03:57 +00:00
Remove all use of sudoers file (#3477)
This commit is contained in:
@@ -19,8 +19,6 @@ RUN --mount=target=/build,source=build \
|
||||
RUN --mount=target=/build,source=build \
|
||||
/build/run.sh setup-user
|
||||
|
||||
COPY --chmod=644 files/sudoers* /etc/sudoers.d
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
ARG APPS_REV=1
|
||||
|
||||
@@ -17,8 +17,9 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = 0 -a $UID != 0 ]; then
|
||||
exec $(getSudoFromDistro) minecraft bash -c "echo '$*' > '${CONSOLE_IN_NAMED_PIPE}'"
|
||||
if [[ "$(id -u)" = 0 ]] && [[ $UID != 0 ]]; then
|
||||
error "Exec needs to be run with user ID $UID"
|
||||
exit 2
|
||||
else
|
||||
echo "$@" >"${CONSOLE_IN_NAMED_PIPE}"
|
||||
fi
|
||||
|
||||
@@ -24,7 +24,7 @@ _The `-i` is not needed in this case._
|
||||
If rcon is disabled you can send commands by passing them as arguments to the packaged `mc-send-to-console` script after setting the env var `CREATE_CONSOLE_IN_PIPE` to "true". For example, a player can be op'ed in the container `mc` with:
|
||||
|
||||
```shell
|
||||
docker exec mc mc-send-to-console op player
|
||||
docker exec --user 1000 mc mc-send-to-console op player
|
||||
| |
|
||||
+- container name +- Minecraft commands start here
|
||||
```
|
||||
|
||||
@@ -6,8 +6,5 @@ if isTrue "${DEBUG_AUTOSTOP}"; then
|
||||
fi
|
||||
|
||||
logAutostopAction "Stopping Java process"
|
||||
if isTrue "${AUTOSTOP_PKILL_USE_SUDO:-false}"; then
|
||||
sudo pkill -f --signal SIGTERM mc-server-runner
|
||||
else
|
||||
pkill -f --signal SIGTERM mc-server-runner
|
||||
fi
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/bin/pkill
|
||||
Reference in New Issue
Block a user