# Getting setfacl working inside container

**URL:** <https://forums.docker.com/t/getting-setfacl-working-inside-container/143457>\
**Category:** General\
**Created:** [August 29, 2024, 1:12pm UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457 "2024-08-29T13:12:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![123pla](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/123pla/32/50855_2.png) [@123pla](https://forums.docker.com/u/123pla)\
**Post date:** [August 29, 2024, 1:12pm UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/1 "2024-08-29T13:12:40Z")

</div>

I’m trying to set up default files permission inside linux container using command setfacl but I’m getting error “Operation not supported”

it looks like there is an acl option missed in /etc/mtab in root file definition (overlay) but when I’m trying to open the file /proc/mounts (aka ~self/mounts) for edit I’m getting empty file … Any ideas how to pemanently add this acl option ?

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [August 29, 2024, 5:41pm UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/2 "2024-08-29T17:41:29Z")

</div>

According to the `setfacl` man page, the capability `CAP_FOWNER` is required:

> **PERMISSIONS**
> 
> The file owner and processes capable of CAP\_FOWNER are granted the right to modify ACLs of a file. This is analogous to the permissions required for accessing the file mode. (On current Linux systems, root is the only user with the CAP\_FOWNER capability.)

You need to add the capability `FOWNER` to your container:

- docker run: [https://docs.docker.com/engine/containers/run/#runtime-privilege-and-linux-capabilities](https://docs.docker.com/engine/containers/run/#runtime-privilege-and-linux-capabilities)
- compose: [https://docs.docker.com/reference/compose-file/services/#cap\_add](https://docs.docker.com/reference/compose-file/services/#cap_add)

---

<div class="post-metadata">

**Author:** ![123pla](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/123pla/32/50855_2.png) [@123pla](https://forums.docker.com/u/123pla)\
**Post date:** [August 29, 2024, 7:45pm UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/3 "2024-08-29T19:45:24Z")

</div>

it can be added to the containter during creation like i.e. variable PATH ?

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [August 29, 2024, 7:50pm UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/4 "2024-08-29T19:50:27Z")

</div>

I am not sure what to respond to that. Have you actually followed the links I shared?

---

<div class="post-metadata">

**Author:** ![123pla](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/123pla/32/50855_2.png) [@123pla](https://forums.docker.com/u/123pla)\
**Post date:** [August 30, 2024, 4:45am UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/5 "2024-08-30T04:45:08Z")

</div>

yes, and as far as I understand using “docker run” command causes that this particular cap will be added for “one-time” launch of the container …

---

<div class="post-metadata">

**Author:** ![123pla](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/123pla/32/50855_2.png) [@123pla](https://forums.docker.com/u/123pla)\
**Post date:** [August 30, 2024, 5:16am UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/6 "2024-08-30T05:16:49Z")

</div>

small update - it seems that this is already addded …

```auto
root@1711fbe8e2ee:/# capsh --print
Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+ep
Bounding set =cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap
Securebits: 00/0x0/1'b0
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: no (unlocked)
 secure-keep-caps: no (unlocked)
uid=0(root)
gid=0(root)
groups=0(root)

```

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [August 30, 2024, 5:51am UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/7 "2024-08-30T05:51:10Z")

</div>

> [@123pla](#):
>
> yes, and as far as I understand using “docker run” command causes that this particular cap will be added for “one-time” launch of the container …

Settings in `docker run` apply for the created container, and apply until the container is deleted. I am not sure what you mean with “one-time”?

> [@123pla](#):
>
> small update - it seems that this is already addded …

It was just a hunch after looking at the documentation/man page, where I stumbled across CAP\_FOWNER. I have no idea what else is missing/required.

I will leave this topic for someone who actually uses `setfacl` inside a container.

---

<div class="post-metadata">

**Author:** ![123pla](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/123pla/32/50855_2.png) [@123pla](https://forums.docker.com/u/123pla)\
**Post date:** [August 30, 2024, 6:03am UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/8 "2024-08-30T06:03:05Z")

</div>

I’ve always created containers from QNAP GUI so I was not familiar with command line … now I did some test, pull fresh image from repositiry, create container using “docker run” commad with CAP added but results are the same ☹

I think the clue is to have mounted file system with “acl” option …

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [August 30, 2024, 6:06am UTC](https://forums.docker.com/t/getting-setfacl-working-inside-container/143457/9 "2024-08-30T06:06:14Z")

</div>

I can’t tell you how QNAP handles it. Though, I can tell that Synology’s ACL implemention is incompatible with the ACL package of normal distributions (what the containers use). I hope it’s not the case with QNAP.
