Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 9ae85a6

Browse files
committed
[33] Make dhcpd process run as the dhcpd user and group
1 parent 139726c commit 9ae85a6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

util/entrypoint.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ if [ -n "$IFACE" ]; then
5151

5252
uid=$(stat -c%u "$data_dir")
5353
gid=$(stat -c%g "$data_dir")
54-
if [ $gid -ne 0 ]; then
55-
groupmod -g $gid dhcpd
56-
fi
57-
if [ $uid -ne 0 ]; then
58-
usermod -u $uid dhcpd
59-
fi
54+
groupmod -og $gid dhcpd
55+
usermod -ou $uid dhcpd
6056

6157
[ -e "$data_dir/dhcpd.leases" ] || touch "$data_dir/dhcpd.leases"
6258
chown dhcpd:dhcpd "$data_dir/dhcpd.leases"
@@ -69,7 +65,7 @@ if [ -n "$IFACE" ]; then
6965
echo "You must add the 'docker run' option '--net=host' if you want to provide DHCP service to the host network."
7066
fi
7167

72-
$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" $IFACE
68+
$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" -user dhcpd -group dhcpd $IFACE
7369
else
7470
# Run another binary
7571
$run "$@"

0 commit comments

Comments
 (0)