Skip to content

Conversation

devanbenz
Copy link

  • fix(packaging): init.sh should run buildtsi as influxdb user

The init.sh script assumes that it being run as root so thus we can use sudo to switch user to the influxdb user to run buildtsi; otherwise the files are owned by root and influxdb can't start.

We want to run a command as another user but su has a frustrating syntax for calling a command and escaping, runuser is simpiler but delegates to su so both use PAM which is not needed in this case. It was recommended to use setpriv which a full toolkit for setting privilege bits and can mimic su/runuser by setting privilege to a specific user for running a command. It seems to work and be easy to use in a script.

  • chore: update comment to reflect setpriv usage

(cherry picked from commit 7ca78d1)

* fix(packaging): init.sh should run buildtsi as influxdb user

The init.sh script assumes that it being run as root so thus we can use
sudo to switch user to the influxdb user to run buildtsi; otherwise the
files are owned by root and influxdb can't start.

* fixes #26698

* chore: switch from sudo to su; update comment

* chore: switch to runuser as the su syntax and debugging is difficult

* chore: switch to setpriv to avoid PAM

We want to run a command as another user but su has a frustrating syntax
for calling a command and escaping, runuser is simpiler but delegates to
su so both use PAM which is not needed in this case. It was recommended
to use setpriv which a full toolkit for setting privilege bits and can
mimic su/runuser by setting privilege to a specific user for running a
command. It seems to work and be easy to use in a script.

* chore: update comment to reflect setpriv usage

(cherry picked from commit 7ca78d1)
Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@devanbenz devanbenz merged commit 70543be into 1.12 Sep 30, 2025
9 checks passed
@devanbenz devanbenz deleted the db/cherrypick-7ca78 branch September 30, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants