What is a system user and how do I create a system user ? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
BrianKasingli
BrianKasingliAccepted solution
New Participant
Feb 23, 2023 7:10 AM UTC

You can find my blog on what is an AEM system user on AEM, and how to set one up by searching on google, "what is AEM system user"; points you to Create System | Service Users in AEM 6.5 with Code Configurations - Sourced Code. In this awesome blog article, you will also have some code examples for how you can write changes to AEM.

 

But let's share what is a system user? A system user is a JCR user with no password set and a minimal set of privileges that are necessary to perform a specific task. Having no password set means that it will not be possible to login with a system user. A system user is typically utilized by the AEM backend code which have privileges to create, read, update, and delete nodes in the JCR; the backend code will authenticate as a system user as a session when needed, and is required to session logout right when the task or tasks have been completed. Not logging out of a system user from the AEM backend will cause issues. If you do not logout of a session that you have opened, your AEM will be flooded by opened sessions, your AEM will start complaining with *INFO* [Apache Sling Resource Resolver Finalizer Thread] org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl Unclosed ResourceResolver, and eventually your AEM environment will run out of memory and crash; to learn more about this topic, take a look at this blog article, ResourceResolvers and Sessions — “you open it, you close it”, by Jörg Hoh. The rule of thumb for creating System Users is to keep the privileges very specific; ensure you have a plan for this system user.

if you are on AEM 6.5.4+, you can With the org.apache.sling.jcr.repoinit.RepositoryInitializer factory PID to create a system user from the code. 

scripts=[" create service user sourcedCodeSystemUser with path /home/users/system/sourcedCode set ACL for sourcedCodeSystemUser allow jcr:read,rep:write,crx:replicate on /content/sourcedcode allow jcr:read,rep:write,crx:replicate on /conf/sourcedcode allow jcr:all on /content/we-retail end "]



Take a look here: Create System | Service Users in AEM 6.5 with Code Configurations - Sourced Code

3 replies

Shiv_Prakash_Patel
New Participant
Feb 23, 2023 10:11 AM UTC

Hi @arindam6600 , Please check out this for system user creation and their use for getting resource resolver. - https://unlocklearning.in/resource-resolver-in-aem/ 

 

 

Translate
Shiv Prakash
BrianKasingli
BrianKasingliAccepted solution
New Participant
Feb 23, 2023 7:10 AM UTC

You can find my blog on what is an AEM system user on AEM, and how to set one up by searching on google, "what is AEM system user"; points you to Create System | Service Users in AEM 6.5 with Code Configurations - Sourced Code. In this awesome blog article, you will also have some code examples for how you can write changes to AEM.

 

But let's share what is a system user? A system user is a JCR user with no password set and a minimal set of privileges that are necessary to perform a specific task. Having no password set means that it will not be possible to login with a system user. A system user is typically utilized by the AEM backend code which have privileges to create, read, update, and delete nodes in the JCR; the backend code will authenticate as a system user as a session when needed, and is required to session logout right when the task or tasks have been completed. Not logging out of a system user from the AEM backend will cause issues. If you do not logout of a session that you have opened, your AEM will be flooded by opened sessions, your AEM will start complaining with *INFO* [Apache Sling Resource Resolver Finalizer Thread] org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl Unclosed ResourceResolver, and eventually your AEM environment will run out of memory and crash; to learn more about this topic, take a look at this blog article, ResourceResolvers and Sessions — “you open it, you close it”, by Jörg Hoh. The rule of thumb for creating System Users is to keep the privileges very specific; ensure you have a plan for this system user.

if you are on AEM 6.5.4+, you can With the org.apache.sling.jcr.repoinit.RepositoryInitializer factory PID to create a system user from the code. 

scripts=[" create service user sourcedCodeSystemUser with path /home/users/system/sourcedCode set ACL for sourcedCodeSystemUser allow jcr:read,rep:write,crx:replicate on /content/sourcedcode allow jcr:read,rep:write,crx:replicate on /conf/sourcedcode allow jcr:all on /content/we-retail end "]



Take a look here: Create System | Service Users in AEM 6.5 with Code Configurations - Sourced Code

Translate
Manu_Mathew_
New Participant
Feb 23, 2023 6:43 AM UTC