Security

Is it possible to modify users settings using the CLI?

JuGuSm
Path Finder

Hi,

I would like to modify some users option like "search assistant" or "syntax highlighting" using the CLI ; is it possible?

0 Karma
1 Solution

MuS
Legend

Hi JuGuSm,

well using CLI is a broad statement, and therefore I can answer this question with Yes, of course you can use CLI to change it.

Let me show you how to change the option search_assistant = none to search_assistant = full using CLI commands.

first option, use sed

sed -i 's/search_assistant = none/search_assistant = full/' /opt/splunk/etc/users/<username>/user-prefs/local/user-prefs.conf

second option, use curl and edit it using the REST endpoint:

curl -u admin:changeme -k https://localhost:8089//servicesNS/admin/user-prefs/properties/user-prefs/general/search_assistant -d value=full 

The result will be like this:

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <msg type="INFO">Successfully modified 1 key(s)</msg>
  </messages>
</response>

Third option, use any CLI text editor and modify the file - yeah I know, lame but still a CLI option.

So, as you can see there are ways to edit the setting using CLI commands 😉

Hope this helps ...

cheers, MuS

View solution in original post

MuS
Legend

Hi JuGuSm,

well using CLI is a broad statement, and therefore I can answer this question with Yes, of course you can use CLI to change it.

Let me show you how to change the option search_assistant = none to search_assistant = full using CLI commands.

first option, use sed

sed -i 's/search_assistant = none/search_assistant = full/' /opt/splunk/etc/users/<username>/user-prefs/local/user-prefs.conf

second option, use curl and edit it using the REST endpoint:

curl -u admin:changeme -k https://localhost:8089//servicesNS/admin/user-prefs/properties/user-prefs/general/search_assistant -d value=full 

The result will be like this:

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <msg type="INFO">Successfully modified 1 key(s)</msg>
  </messages>
</response>

Third option, use any CLI text editor and modify the file - yeah I know, lame but still a CLI option.

So, as you can see there are ways to edit the setting using CLI commands 😉

Hope this helps ...

cheers, MuS

JuGuSm
Path Finder

Awesome! Thank you for this very comprehensive answer.

0 Karma

adonio
Ultra Champion

probably not, but would be great to know if im wrong
read here:
http://docs.splunk.com/Documentation/Splunk/7.1.2/Admin/CLIadmincommands
pay attention to the add and remove command and their perspective attributes

0 Karma

pruthvikrishnap
Contributor

Hi, I dont think these capabilities are available from CLI, few operations can be done using CLI but not changing the user options.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...