Security

Is there a flat file where Splunk user names and assigned roles stored?

jrdba
Explorer

Hi folks, I was wondering if there was a flat file that exists where user account names & their assigned roles are stored? I'm not trying to get passwords, just user names and assigned roles which we manually create. I'm trying to automate this process via powershell. Manual process is taking too long. Thank you much 🙂

Access control | Users | New button

0 Karma
1 Solution

vasanthmss
Motivator

Hi,

Below Search will help you to get the list of users, and you can write it in to csv / flat file.

|rest /services/authentication/users splunk_server=local |fields title roles realname email|rename title as userName|rename realname as Name | table Name, userName, email, roles | stats values(*) as * by userName delim=", " | nomv roles

You can use the command line / REST to create user. Either way you can do the same thing in your script,

Read this Doc

 1. Write a script to search list of users and their roles (the above search query) and output your results to CSV/flat file. So you can access the csv/flat file from your script.
 2. using REST / Command line user insert you can create n number of users.

Cheers!

V

View solution in original post

vasanthmss
Motivator

Hi,

Below Search will help you to get the list of users, and you can write it in to csv / flat file.

|rest /services/authentication/users splunk_server=local |fields title roles realname email|rename title as userName|rename realname as Name | table Name, userName, email, roles | stats values(*) as * by userName delim=", " | nomv roles

You can use the command line / REST to create user. Either way you can do the same thing in your script,

Read this Doc

 1. Write a script to search list of users and their roles (the above search query) and output your results to CSV/flat file. So you can access the csv/flat file from your script.
 2. using REST / Command line user insert you can create n number of users.

Cheers!

V

jrdba
Explorer

When i try to run a CLI command to add a dummy user account i get an error about non existent role. I can see the role exists in the admin web page under the "roles" column....

Ran command like this...

d:_programfiles_splunk_bin> .\splunk.exe add user michael -password changeme -role app-test -auth admin:[our password]

"In handler 'users' : Error creating user. role="app-test" does not exist"

Why would this be happening? Thanks for assistance

0 Karma

jrdba
Explorer

I just realized basically run this search on the GUI. Thanks

0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...