Installation

Can't write file "/root/.splunk/

sramiz
Path Finder

Hello,

Splunk version is 8.0.6. trying to configure searchHead to connect to deployer. running following command but getting an error.

sudo /opt/splunk/bin/splunk init shcluster-config -auth admin:password1 -mgmt_uri https://10.31.0.28:8089 -replication_port 9000 -replication_factor 3 -conf_deploy_fetch_url http://10.31.0.33:8089 -secret password1 -shcluster_label stg-shcluster1


Can't write file "/root/.splunk/authToken_hostname1_8089": Permission denied

splunk is running as a splunk user and have configured boot-start in systemd

Note:

1. I have read previous posts about similar error but their case is different than mine, i am not starting or have not started splunk as root user.

2. I have already added /opt/splunk/bin/splunk command in /etc/sudoers file to allow splunk user.

any suggestions?

regards,

SR

Labels (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

Hi

1st stop splunk and after that sudo chown -R splunk:splunk /opt/splunk. Then start it again.

In your example you are trying to do that initialisation as root. Only time when you should use user root is enable boot-start (or start/stop/restart with systemd).  

The error message shows that for some reason it try to write some status information to /root/.splunk directory which didn't succeed as splunk is running as user splunk not as root.

You should do sudo -u splunk bash then run those command as user splunk. 

I propose you to use DNS names instead of IP address for hosts.

When you are adding -conf_deploy_fetch_url you must ensure that this server is up and running.

r. Ismo

View solution in original post

0 Karma

sramiz
Path Finder

Thats correct. it worked for me when I used splunk command as splunk user without sudo.

thanks

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

1st stop splunk and after that sudo chown -R splunk:splunk /opt/splunk. Then start it again.

In your example you are trying to do that initialisation as root. Only time when you should use user root is enable boot-start (or start/stop/restart with systemd).  

The error message shows that for some reason it try to write some status information to /root/.splunk directory which didn't succeed as splunk is running as user splunk not as root.

You should do sudo -u splunk bash then run those command as user splunk. 

I propose you to use DNS names instead of IP address for hosts.

When you are adding -conf_deploy_fetch_url you must ensure that this server is up and running.

r. Ismo

0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...