Run Splunk Enterprise as a different or non-root user
Important: This topic is for non-Windows operating systems only.
- To configure Splunk software to run at boot time as a non-root user, see Enable boot-start as a non-root user.
- To learn how to install Splunk Enterprise on Windows using a user that is not an administrator, see Choose the user Splunk Enterprise should run as.
- To learn how to change the Windows user that Splunk Enterprise services use, see Change the user selected during Windows installation.
You can run Splunk Enterprise as any user on the local system. It is a Splunk best practice to run Splunk software as a non-root user.
If you run Splunk software as a non-root user, confirm that it can:
- Read the files and directories that you configure it to monitor. Some log files and directories might require root or superuser access to be indexed.
- Write to the Splunk Enterprise directory and execute any scripts configured to work with your alerts or scripted input.
- Bind to the network ports it is listening on. Network ports below 1024 are reserved ports that only the root user can bind to.
Because network ports below 1024 are reserved for root access only, Splunk software can only listen on port 514 (the default listening port for syslog) if it runs as root. You can, however, install another utility (such as syslog-ng) to write your syslog data to a file and have Splunk monitor that file instead.
Set up Splunk software to run as a non-root user
- Install Splunk software as the root user, if you have root access. Otherwise, install the software into a directory that has write access for the user that you want Splunk software to run as.
- Change the ownership of the
$SPLUNK_HOMEdirectory to the user that you want Splunk software to run as.
- Start the Splunk software.
Example instructions on how to install Splunk software as a non-root user
In this procedure,
$SPLUNK_HOME represents the path to the Splunk Enterprise installation directory.
- Log into the machine that you want to install Splunk software as root.
- Create the
splunkuser and group.
On Linux, Solaris, and FreeBSD:
useradd splunk groupadd splunk
On Mac OS: You can use the System Preferences > Accounts System Preferences panel to add users and groups.
- Install the Splunk software, as described in [Chooseyourplatform|Installation instructions].
Do not start Splunk Enterprise yet.
- Run the
chowncommand to change the ownership of the
splunkdirectory and everything under it to the user that you want to run the software.
chown -R splunk:splunk $SPLUNK_HOME
If the 'chown' binary on your system does not support changing group ownership of files, you can use the 'chgrp' command instead. See the 'man' pages on your system for additional information on changing group ownership.
- Become the non-root user.
su - <user>
You can also log out of the root account and log in as that user
- Start the Splunk software.
Use sudo to start or stop Splunk software as a different user
If you want to start Splunk Enterprise as the
splunk user while you are logged in as a different user, you can use the
sudo -H -u splunk $SPLUNK_HOME/bin/splunk start sudo -H -u splunk $SPLUNK_HOME/bin/splunk stop
This example command assumes the following:
- That Splunk Enterprise has been installed in the default installation directory. If Splunk Enterprise is in an alternate location, update the path in the command accordingly.
- That your system has the
sudocommand available. If this is not the case, use
suor get and install
- That you have already created the user that you want Splunk software to run as.
- That the
splunkuser has access to the
/dev/urandomdevice to generate the certificates for the product.
Additional privileges and network ports required for installation on Solaris 10
When installing Splunk Enterprise on Solaris 10 as the
splunk user, you must set additional privileges to start
splunkd and bind to reserved ports.
splunkd as the
splunk user on Solaris 10, run:
usermod -K defaultpriv=basic,net_privaddr,proc_exec,proc_fork splunk
To allow the
splunk user to bind to reserved ports on Solaris 10, run (as root):
usermod -K defaultpriv=basic,net_privaddr splunk
Install on HP-UX
Start Splunk Enterprise for the first time
This documentation applies to the following versions of Splunk® Enterprise: 6.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.14, 6.0.15, 6.1, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.5, 6.1.6, 6.1.7, 6.1.8, 6.1.9, 6.1.10, 6.1.11, 6.1.12, 6.1.13, 6.1.14, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.5, 6.2.6, 6.2.7, 6.2.8, 6.2.9, 6.2.10, 6.2.11, 6.2.12, 6.2.13, 6.2.14, 6.2.15