Search code examples
linuxazure-blob-storagemountazure-batch

Accessing Mounted Files in Azure Batch: "Permission Denied" Issue


I am working on an Azure Batch job where I need to access files mounted at a specific directory path. However, I am encountering a "Permission Denied" error when trying to access these files. The files are mounted from storage account - which is done when creating a Batch Pool.

I have a directory mounted at /mnt/batch/tasks/fsmounts/test. When I for example run the command line "ls /mnt/batch/tasks/fsmounts/test" from a job task, I get the following error message:

ls: cannot access '/mnt/batch/tasks/fsmounts/test': Permission denied

From the Pool node I've verified that the files are indeed mounted in the fsmounts folder, but I'm having trouble accessing them from a job task. I am able to access other files in the fsmounts folder.

I've tried differenct approach in the mount configuration - using access key, SAS key, and Identity reference

Has anyone experienced something similar? All help is appreciated.


Solution

  • As per the Azure Batch Virtual Filesystem documentation for Azure Blob Containers, the mount is most likely restricted to root only:

    To get default access to the BlobFuse mounted directory, run the task as an administrator. BlobFuse mounts the directory at the user space, and at pool creation mounts the directory as root. In Linux, all administrator tasks are root. The FUSE reference page describes all options for the FUSE module.

    You are probably running your tasks with lower privilege than the mount. If your scenario allows lower privileged users to access the blob container, then you most likely need to specify -o allow_other under BlobfuseOptions as part of the MountConfiguration. If not, you will need to elevate your tasks to run as admin (i.e., root).