Problem Statement
When setting up Artifactory Backups, a Backup directory will be generated at the designated path to store all data. By default, this directory is owned by artifactory:artifactory.
There could be a scenario when the Backup of the Artifactory fails with the below errors. These errors could be found in artifactory-service.log file.
Solution
As per the logs, the Artifactory Backup export failed because of the permission denied error. To fix this, ensure that the Artifactory Backup directory [say $JFROG_HOME/artifactory/var/backup] should be having same permission as of $JFROG_HOME/artifactory/var/ directory.
When setting up Artifactory Backups, a Backup directory will be generated at the designated path to store all data. By default, this directory is owned by artifactory:artifactory.
There could be a scenario when the Backup of the Artifactory fails with the below errors. These errors could be found in artifactory-service.log file.
Failed to export metadata of '/opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/repositories/gradle-release-local.artifactory-metadata/artifactory-folder.xml' + to '/opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/repositories/gradle-release-local.artifactory-metadata/artifactory-folder.xml: /opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/repositories/gradle-release-local.artifactory-metadata/artifactory-folder.xml (Permission denied)[or]
2024-07-28T10:59:29.746Z [jfrt ] [ERROR] [34f0457edf8fb3ce] [ifactoryApplicationContext:938] [edf8fb3ce|art-exec-2] - java.io.FileNotFoundException: /opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/artifactory.repository.config.json (Permission denied) org.jfrog.common.JsonSensitiveDataException: java.io.FileNotFoundException: /opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/artifactory.repository.config.json (Permission denied) at org.jfrog.common.MapperUtilsBase.unchecked(MapperUtilsBase.java:282) at org.jfrog.common.MapperUtilsBase.writeValue(MapperUtilsBase.java:137) at org.jfrog.common.JsonUtils.writeValue(JsonUtils.java:29) at [..] Caused by: java.io.FileNotFoundException: /opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/artifactory.repository.config.json (Permission denied) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184) at [..][or]
2024-07-28T10:59:29.747Z [jfrt ] [ERROR] [34f0457edf8fb3ce] [ifactoryApplicationContext:939] [edf8fb3ce|art-exec-2] - Full system export failed: java.io.FileNotFoundException: /opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/artifactory.repository.config.json (Permission denied): java.io.FileNotFoundException: /opt/jfrog/artifactory/var/backup/artifactory/backup-daily/current/artifactory.repository.config.json (Permission denied)
Solution
As per the logs, the Artifactory Backup export failed because of the permission denied error. To fix this, ensure that the Artifactory Backup directory [say $JFROG_HOME/artifactory/var/backup] should be having same permission as of $JFROG_HOME/artifactory/var/ directory.