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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...