Modifying SFTP container directory permissions via ACL

Shashwat Tiwary 80 Reputation points
2024-08-28T06:44:04.85+00:00

Hi,

I have setup up an SFTP service over Azure blob storage for a data vendor. The container has three folders - inbound, outbound and archive. From the portal I can give the permissions (READ, WRITE or LIST) to a local user for the whole container which is inherited by the directories and future files with in the directories. However, I want to setup granular permissions at the directory level for a local user instead at container level. I have referred the below two articles but it did not helped much.

  1. https://video2.skills-academy.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support#access-control-lists-acls
  2. https://video2.skills-academy.com/en-us/azure/storage/blobs/data-lake-storage-acl-azure-portal

I have tabulated my requirement in the table below. Can someone who has done this help me out to set this up?

User's image

Regards,

Shashwat

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,217 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,918 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Nehruji R 8,066 Reputation points Microsoft Vendor
    2024-08-29T11:25:51.6466667+00:00

    Hello Shashwat Tiwary,

    Greetings! Welcome to Microsoft Q&A Platform.

    Yes, you can configure ACLs for an SFTP local account down to the container and sub-folder level using Azure CLI, Azure PowerShell or via Azure Portal and you can configure based on your required method.

    If you are referring to containers, you need to use ADLS Gen2 for more granular access. Access control lists (ACLs): ACLs give you the ability to apply "finer grain" level of access to directories and files. An ACL is a permission construct that contains a series of ACL entries. Each ACL entry associates security principal with an access level. To learn more, see Access control lists (ACLs) in Azure Data Lake Storage Gen2.

    Also refer - https://video2.skills-academy.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support, https://video2.skills-academy.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support-authorize-access?tabs=azure-cli.

    You can set the desired permissions at the container level using Azure Portal or Azure Storage Explorer. These permissions are inherited by all blobs (files) and virtual directories (folders) within the container.

    To grant access to a container, you can assign an RBAC role at the container scope or above to a user, group, service principal, or managed identity. You may also choose to add one or more conditions to the role assignment. You can read about the assignment of roles at Assign Azure roles using the Azure portal.

    Also, folders in the Azure Blob storage are virtual. They look like folders, but they are not real folders just like the folders on your local computer.

    If you need to grant access on folder level, you need to use Azure Data Lake Gen2 i.e. Azure Storage account where Hierarchical namespace setting is enabled. For existing storage account blob container/ folder: Access control lists (ACLs) in Azure Data Lake Storage Gen2

    For more fine-grained control, you can set ACLs at the individual blob (file) level.

    Navigate to the specific blob, and in the Azure Portal or Azure Storage Explorer, set the access controls for that specific blob (This can be more granular but might not be practical for a large number of files).

    Additional information: Authorizing access to Azure Storage

    If you are referring to Azure File shares, please see: Configure directory and file level permissions over SMB: After you assign share-level permissions, you must first connect to the Azure file share using the storage account key and then configure Windows access control lists (ACLs), also known as NTFS permissions, at the root, directory, or file level. While share-level permissions act as a high-level gatekeeper that determines whether a user can access the share, Windows ACLs operate at a more granular level to control what operations the user can do at the directory or file level.

    Similar thread for reference - https://video2.skills-academy.com/en-us/answers/questions/1290110/setting-up-sftp-with-windows-vm-azure-file-share?source=docs

    Hope this answer helps! please let us know if you have any further queries. I’m happy to assist you further.

    Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members


  2. Sumarigo-MSFT 46,441 Reputation points Microsoft Employee
    2024-09-16T05:20:15.18+00:00

    @Shashwat Tiwary Apologies for the delay response!

    The referenced article has the instructions for ACLs and should work for this scenario. Have you used an SFTP client to set the granular permissions for each folder and user?

    Example: https://video2.skills-academy.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support-connect#modify-the-acl-of-a-file-or-directory

    If the issue still persist, I would like to work closer on this issue!


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.