Skip to main content

Adding basic security to your server, requires altering the security.json file.  For me this file was located

/var/solr/data/

 

Add a User or Edit a Password

The set-user command allows you to add users and change their passwords. For example, the following defines two users and their passwords:

curl --user solr:SolrRocks http://localhost:8983/api/cluster/security/authentication -H 'Content-type:application/json' -d '{"set-user": {"andrew":"andrewsPass"}}'

 

Delete a User

The delete-user command allows you to remove a user. The user password does not need to be sent to remove a user. In the following example, we’ve asked that user IDs 'andrew' and 'harry' be removed from the system.

curl --user solr:SolrRocks http://localhost:8983/api/cluster/security/authentication -H 'Content-type:application/json' -d  '{"delete-user": ["andrew"]}'

 

Set a Property

Set properties for the authentication plugin. The currently supported properties for the Basic Authentication plugin are blockUnknown, realm and forwardCredentials.

curl --user solr:SolrRocks http://localhost:8983/api/cluster/security/authentication -H 'Content-type:application/json' -d  '{"set-property": {"blockUnknown":false}}'

 

Success response

A successful response will look like

{

   "responseHeader": {

      "status":0,

      "QTime":4}}

 

Related articles

Andrew Fletcher17 Feb 2024
Drupal - Solr working through tm_X3b_en_body error
Having updated Solr, re-indexing wasn't working. The error in the logs wasDrupal\search_api_solr\SearchApiSolrException while indexing item entity:node/2386:en: Solr endpoint http://127.0.0.1:8983/ bad request (code: 400, body: Exception writing document id...
Andrew Fletcher17 Feb 2024
Solr commands
On an Ubuntu 20.02 system with Nginx, you can utilize the following commands to handle Solr:To verify the status of the Solr servicesudo systemctl status solrTo restart the Solr servicesudo systemctl restart solrStart Solrsudo systemctl start solrStop Solrsudo systemctl stop solrEnable Solr (Start...