Skip to content

Commit b82af3f

Browse files
izmalJiriCtvrtka
andauthored
fix: use useradd instead of adduser for cross-version compatibility (#1182)
Replace adduser with useradd for mongodb_exporter user creation. The --comment option in adduser is not supported in Debian 11, only in Debian 12+. useradd works consistently across all versions. Co-authored-by: Jiří Čtvrtka <[email protected]>
1 parent df4a5c0 commit b82af3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.scripts/postinst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ set -e
44

55
echo "Creating user and group..."
66

7-
adduser --system --no-create-home --comment "Mongodb Exporter User" mongodb_exporter
7+
useradd --system \
8+
--no-create-home \
9+
--shell /sbin/nologin \
10+
--comment "MongoDB Exporter" \
11+
mongodb_exporter
812

913
systemctl daemon-reload > dev/null || exit $?
1014

0 commit comments

Comments
 (0)