Jira server running as unexpected user after using Linux installer

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  • The JIRA Service is running as the incorrect, or undesirable user after installing JIRA from the binary installer.
  • The user jira1 is running the JIRA process instead of jira.
  • The JIRA process can not be started as the expected user, and exceptions mentioning Permission denied

The following may be found in the atlassian-jira.log:

2015-01-01 20:00:00,805 http-bio-2002-exec-01 ERROR captainplanet 1374x4807x2 1uqrzw9 192.168.0.1 /secure/AttachFile.jspa [jira.issue.managers.DefaultAttachmentManager] Could not save attachment to storage: com.atlassian.jira.issue.attachment.AttachmentWriteException: Could not save attachment data from stream.
com.atlassian.jira.issue.attachment.AttachmentWriteException: Could not save attachment data from stream.
	at com.atlassian.jira.issue.attachment.DefaultAttachmentStore$2.call(DefaultAttachmentStore.java:133)
	at com.atlassian.jira.issue.attachment.DefaultAttachmentStore$2.call(DefaultAttachmentStore.java:122)
	at com.atlassian.util.concurrent.Executors$DefaultSubmitter$CallableRunner.run(Executors.java:62)
	at com.atlassian.util.concurrent.LimitedExecutor$Runner.run(LimitedExecutor.java:93)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(Unknown Source)
	at com.atlassian.core.util.FileUtils.copyFile(FileUtils.java:461)
	at com.atlassian.jira.issue.attachment.DefaultAttachmentStore$2.call(DefaultAttachmentStore.java:128)
	... 6 more

Cause

When the JIRA Binary Installer creates a new JIRA instance, if the jira user already exists, a new user is created. This may be undesirable causing the wrong user to run JIRA. The JIRA Binary installer automatically creates users in a sequential format, for example, jira1jira2jira3. There is an issue to track this behaviour:  JRA-27376 - Getting issue details... STATUS

Resolution

You will need to decide what user should execute JIRA. In the steps below the username: jira is being used.

  1. Shutdown JIRA using either:
    1. the service: service <JIRA_SERVICE_NAME> stop 
    2. the command <JIRA_INSTALL>/bin/stop-jira.sh
  2. Ensure you can log into your jira user account.

  3. Set jira to have correct permissions on your <JIRA_INSTALL>. One method to do this is to run the following command as a super-user:

    chown jira:jira -R <JIRA_INSTALL>


  4. Update the file <JIRA_INSTALL>/bin/user.sh so that the script references the correct user. For example, change jira1 in the file to jira:

    # START INSTALLER MAGIC ! DO NOT EDIT !
    JIRA_USER="jira1" ##
    # END INSTALLER MAGIC ! DO NOT EDIT !
    export JIRA_USER
  5. Start JIRA using either:
    1. the service: service <JIRA_SERVICE_NAME> start 
    2. the command <JIRA_INSTALL>/bin/start-jira.sh
  6. To confirm the correct user is now being used to run JIRA, check the latest: atlassian-jira.log for the property: user.name

Last modified on Sep 25, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.