You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the Kubernetes container spec to enable docker --privileged, can you comment on the security implications of doing this and are there any other workarounds for mount --bind that don't require --privileged?
However it's not necessary to use privileged: true to solve the issue, and we can only use --cap-add=SYS_ADMIN which only adds the requested permission.
Can anyone help on this, using docker compose? I am using the cap_add: section, and I am still getting the error permission denied. This is what my docker compose looks like (minus private info, of course)
[/entrypoint] Running /etc/sftp.d/bindmounts.sh ...
mount: mount /data/myfolder on /home/bkraul/myfolder failed: Permission denied
/entrypoint: Error on line 81: $f
UPDATE: This seems to work using privileged: true. So apparently SYS_ADMIN is not enough?
Reacted by Danilo Ancilotto, Tema Smirnov, Lunuy, FANG and Danton Heuer
This is still a problem with swarm. Swarmed environments do not support privileged, and using cap_add with SYS_ADMIN does not work, as the binds still fail. Is there any other particular capability that can be added for this to work? (swarm now supports caps).
Would love to run it with lower privileges but nothing I tried works. Does anyone have any more surgical/precise solution to fix the permissions without using --privileged?
Would love to run it with lower privileges but nothing I tried works. Does anyone have any more surgical/precise solution to fix the permissions without using --privileged?
@Arcitec
With SYS_ADMIN capability and apparmor profile with mount allowed, you can fix permissions without using --privileged
Activity
pmblatino commentedon Jan 12, 2017
@sijnc hey can you show me your .yaml file, im also trying to run it on kubernetes
joshudev commentedon Jun 20, 2017
+1 What's the best practice for this?
atmoz commentedon Jun 24, 2017
I haven't researched this enough to know how to do it another way or what security implications it has.
Would appreciate if someone could share some knowledge on this!
arkan commentedon Sep 28, 2017
While trying to make https://github.com/atmoz/sftp#bindmount-dirs-from-another-location working I also experienced the same issue.
However it's not necessary to use
privileged: trueto solve the issue, and we can only use--cap-add=SYS_ADMINwhich only adds the requested permission.For more information about this you can read the official documentation here https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities and an interesting stackoverflow answer here https://stackoverflow.com/questions/36553617/how-do-i-mount-bind-inside-a-docker-container
Hope it helps.
atmoz commentedon Sep 29, 2017
Thank you @arkan!
I will add instructions to the readme
bkraul commentedon Nov 20, 2019
Can anyone help on this, using docker compose? I am using the
cap_add:section, and I am still getting the error permission denied. This is what my docker compose looks like (minus private info, of course)This is what the log says:
UPDATE: This seems to work using
privileged: true. So apparentlySYS_ADMINis not enough?FullStackAlex commentedon Jun 21, 2020
Running privileged containers or with sys_admin is a security risk according to the O'Reilly book "Container Security" and those blogs:
https://ericchiang.github.io/post/privileged-containers/
https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/
Both disable the isolation of a container according to those sources.
bkraul commentedon May 27, 2021
This is still a problem with swarm. Swarmed environments do not support
privileged, and usingcap_addwithSYS_ADMINdoes not work, as the binds still fail. Is there any other particular capability that can be added for this to work? (swarm now supports caps).Arcitec commentedon Dec 29, 2021
I was going crazy trying to bind a mounted external drive to a path inside the image via podman.
I could see the folder in the SFTP client, but always got "permission denied" when entering the folder.
Finally,
--privilegedworked.--cap-add=SYS_ADMINdoesn't work.I also had to run podman itself as
sudo...Basically, I had to do this:
Would love to run it with lower privileges but nothing I tried works. Does anyone have any more surgical/precise solution to fix the permissions without using
--privileged?jobggun commentedon Jul 9, 2023
@Arcitec
With SYS_ADMIN capability and apparmor profile with mount allowed, you can fix permissions without using
--privilegedExample of my apparmor profile:
I hope it is helpful for you.