How to fix directory permissions in Linux for Jira Server

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary 

On many occasions, JIRA is not able to run properly due to file or directory permission error

Environment

Any version of Jira installed in a Linux environment

Diagnosis

  • Manually checking Jira's Home and Installation directory show that the ownership of some files/directories is not of the expected Jira user, and also lacking some read/write/execute permissions
  • Errors in the logs will vary, for example an errors like below may show in the logs:

    JIRA couldn't create the jira.home directory
    java.lang.IllegalStateException: java.io.IOException: Permission denied
    Caused by: java.io.IOException: Permission denied
    java.io.FileNotFoundException: atlassian-jira.log (Permission denied)
    org.apache.catalina.startup.HostConfig.beforeStart Unable to create directory for deployment: [path to the directory]

Cause

Jira was likely started with a different user (commonly root) at some point, causing the ownership of the necessary files/directories to be changed.

Even if you specify a user to start Jira in user.sh, this will only be enforced if Jira is started using start-jira.sh. If Jira was started with startup.sh, Jira will run as the user who executed the script, thus possibly causing the ownership of files/directories to be changed.

Solution

There are two options to fix the issue.

Note about files/directories permissions

In this document we suggest the minimum access to files and directories, which is full access to the Linux user running the Jira process and no access to group nor to other.

This is the same suggestion in Installing Jira applications on Linux from Archive File product documentation.

If you believe different files and directories permissions are necessary to your environment you should pair with your Linux administrator to determine the best solution.


Option 1: (Preferred)

Fix the permissions on a case by case basis

  1. You will first need to find out the user who installed JIRA. There are 3 methods to do this :

    1. From The System Info page on your JIRA instance :


    2. From the Support Zip ( application.xml file ) search for <JIRA_USER>

    3. From the $JIRA_HOME/log/atlassian-jira.log, search for 'user.name'

  2. You will also need to know the group the user belongs to run JIRA and most of the time the group name is the same as the username that runs JIRA.  

    If you're unsure of what these permissions should be, please consult with your System Administrator and the user who installed JIRA.

    If you are the user who installed Jira, you can see these details by running these commands:

    	whoami (this will tell your exact username)
    	id -g -n (this will tell your group name)
  3. Next, depending on the actual path in the error, execute the 2 lines below to fix the permission of the JIRA Home & Installation directory

    sudo chown -R jirauser:jiragroup /path/referenced/in/the/error
    sudo chmod -R u=rwx,o-rwx /path/referenced/in/the/error

    You may also want to create particular directories manually instead of granting the access on the upper directories, i.e.:

    mkdir -p /path/referenced/in/the/error

    Substitute Jira with the correct user that installed JIRA and the path with the correct path to the respective directory 

  4. Restart JIRA and check the logs ($JIRA_INST/logs/catalina.out), $JIRA_HOME/logs/atlassian-jira.log) for any other permission denied errors and repeat steps 3 and 4 above until Jira is fully operational

Option 2: 

Disclaimer: The following steps suggest to fix the permissions on all Jira sub directories at once.

While this approach is the quickest to fix the issue, modifying the permissions on all Jira directories is not recommended because:


  1. Follow Steps 1 to 2 to identify the user running Jira
  2. Next, execute the following commands to fix the permissions on all Jira folders:

    sudo chown -R jirauser:jiragroup /path/to/jira-local-home
    sudo chown -R jirauser:jiragroup /path/to/jira-install
    sudo chown -R jirauser:jiragroup /path/to/jira-shared-home
    
    
    chmod -R u=rwx,go-rwx,o-rwx /path/to/jira-local-home
    chmod -R u=rwx,go-rwx,o-rwx /path/to/jira-install
    chmod -R u=rwx,go-rwx,o-rwx /path/to/jira-shared-home




Caveat 

Jira might still fail to start even if the permissions are correct after running the commands to fix the permission of the JIRA Home & Installation directory.

The following error will be present:

Setup: JIRA couldn't create the jira.home directory
Ensure JIRA has permission to create and write to the jira.home directory /jira-home.
Review our documentation for more information on setting your JIRA home.

Solution

This can be caused by a symbolic link hidden in the JIRA Home directory.

Follow the Resolution in Symbolic Link in JIRA Home during upgrading using Installer will throw 'java.lang.OutOfMemoryError: GC overhead limit exceeded'.

DescriptionOn many occasions, JIRA is not able to run properly due to file or directory permission error
ProductJira
PlatformServer
Last modified on Nov 17, 2023

Was this helpful?

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