Security

Splunk startup script, start as splunk user

joberget
Path Finder

Hi, I recently installed the new Splunk Universal Forwarder. I use the built-in bootup script that comes with Splunk, however I want Splunk to start as the splunk user and not root. How do I change that? I know I can add su - splunk in front of the "/opt/splunk/bin/splunk" start --no-prompt. What is best practice here?

splunk_start() {
  echo Starting Splunk...
  su - splunk "/opt/splunk/bin/splunk" start --no-prompt
  RETVAL=$?
}
Tags (3)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

If you set up the boot script using:

./splunk enable boot-start -user splunk

instead of just

./splunk enable boot-start

the boot script will be created to run as the user specified. I believe that it pretty much just uses su - splunk as above though.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

If you set up the boot script using:

./splunk enable boot-start -user splunk

instead of just

./splunk enable boot-start

the boot script will be created to run as the user specified. I believe that it pretty much just uses su - splunk as above though.

gfriedmann
Communicator

You also may want to "chown -R splunk:splunk /opt/splunk" while the system is down.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...