Monitoring Splunk

Splunk start does not work with -user Username; how do I run Splunk as a particular user?

jsmith39
Path Finder

I'm trying to start Splunk on an initial install as a user other than root (splrun).
I create the user account, set a password, and then installed but did not start Splunk as root
and then took the following steps
chown -R splrun:splrun /opt/splunk
/opt/splunk/bin/splunk enable boot-start --accept-license -user splrun
/opt/splunk/bin/splunk start -user splrun .... this failed with a permissions error so I reran chown -R... from above, then reran ..start -user splrun

At this point the webservice (8000) started but the management service (8089) states
"Starting splunk server daemon (splunkd)... Bad Option -u"
then eventually states "Timed out waiting for splunkd to start. [FAILED]"

Running ..splunk status shows
splunkd is not running.
splunkweb is running (PID: 9044).

I appreciate any help in learning how to start Splunk as a non-root user.
Thanks!

Tags (2)
0 Karma
1 Solution

jrodman
Splunk Employee
Splunk Employee

We have no -user flag on 'splunk start'.

Try 'splunk help start'.

In order to run splunk as a particular user:

  • log in as that user and run splunk start

OR

  • Ensure SPLUNK_OS_USER in etc/splunk-launch.conf is your desired user, and then start it via init script or directly as that user or as root

View solution in original post

jsmith39
Path Finder

Thank you for the insight.

Followup question.
I create a user named splrun on the client machine prior to installing Splunk Enterprise via script.
This fails during installation with permission denied issues during the installation.
What is the correct method of prepping the delivery location to avoid this problem.

Thank You.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

after enabling boot-start with -user, you should not use splunk start to start splunk. Instead, you need to use service splunk start. The boot-start installs a startup service that runs as the non-root user. There is no -user option on splunk start.

esix_splunk
Splunk Employee
Splunk Employee

You will need to configure the boot-start user for splunk.

$splunk_home/bin/splunk enable boot-start -user userIwantSplunktoRunAS
e.g. As root: $ /opt/splunk/bin/splunk enable boot-start -user splunkdaemon

That tell splunk which user to run as when the system starts splunk. Not that when you try and start splunk, you need to su or be logged in as that user. If you run it as root, or a different user, it will wreak havoc on your splunk install by resetting permissions and other potentially destructive things.

jrodman
Splunk Employee
Splunk Employee

We have no -user flag on 'splunk start'.

Try 'splunk help start'.

In order to run splunk as a particular user:

  • log in as that user and run splunk start

OR

  • Ensure SPLUNK_OS_USER in etc/splunk-launch.conf is your desired user, and then start it via init script or directly as that user or as root
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...