Skip to content

Permission denied mounted volume with userns=keep-id #3415

Closed

Description

@boydkelly

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description
permissions issue with mounted volume and userns=keep-id and -it bash

When entering container and running bash, permission denied errors when trying to access mounted directories. When doing ls -la permissions look fine,

Steps to reproduce the issue:

  1. Create an image with a user with uid 1000

  2. run podman run --userns=keep-id -v /home/user/somedir:/home/user/somedir ls -la /home/user/somedir

  3. run podman run --userns=keep-id -it -v /home/user/somedir:/home/user/somedir bash

Describe the results you received:
(When running a command as an entrypoint to the container, there is no problem. but when entering the container with bash, permissions look fine but permission denied error when accessing mounted volumes)

[bkelly@zbox ~]$ podman run --userns=keep-id --rm -v /home/bkelly/devel:/home/bkelly/devel wt-vids-dev cat /proc/self/uid_map && id bkelly && ls -tr /home/bkelly/devel
0 1 1000
1000 0 1
1001 1001 64536
uid=1000(bkelly) gid=1000(bkelly) groups=1000(bkelly),10(wheel)
stuff in development
[bkelly@zbox ~]$ podman run --userns=keep-id --rm -it -v /home/bkelly/devel:/home/bkelly/devel wt-vids-dev bash
[bkelly@52d74c9ffc70 ~]$ ls -la /home/bkelly/ && ls -la /home/bkelly/devel
total 24
drwx------. 3 bkelly bkelly 4096 Jun 29 10:41 .
drwxr-xr-x. 3 root root 4096 Jun 29 10:41 ..
-rw-r--r--. 1 bkelly bkelly 18 May 13 12:16 .bash_logout
-rw-r--r--. 1 bkelly bkelly 141 May 13 12:16 .bash_profile
-rw-r--r--. 1 bkelly bkelly 376 May 13 12:16 .bashrc
drwxrwxr-x. 2 bkelly bkelly 4096 Jun 29 10:20 devel
ls: cannot open directory '/home/bkelly/devel': Permission denied
[bkelly@52d74c9ffc70 ~]$

Describe the results you expected:
Should be able to enter the container and access files in users home directory

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

[bkelly@zbox ~]$ podman version
Version:            1.4.0
RemoteAPI Version:  1
Go Version:         go1.12.5
OS/Arch:            linux/amd64

Output of podman info --debug:

[bkelly@zbox ~]$ podman info --debug
debug:
  compiler: gc
  git commit: ""
  go version: go1.12.5
  podman version: 1.4.0
host:
  BuildahVersion: 1.8.3
  Conmon:
    package: podman-1.4.0-2.fc30.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 0.2.0, commit: 3e5b3b1909019a42c7f5a8d47070f0808bfbb35c'
  Distribution:
    distribution: fedora
    version: "30"
  MemFree: 384221184
  MemTotal: 2084212736
  OCIRuntime:
    package: runc-1.0.0-93.dev.gitb9b6cc6.fc30.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc8+dev
      commit: e3b4c1108f7d1bf0d09ab612ea09927d9b59b4e3
      spec: 1.0.1-dev
  SwapFree: 2077487104
  SwapTotal: 2218782720
  arch: amd64
  cpus: 4
  hostname: zbox
  kernel: 5.1.11-300.fc30.x86_64
  os: linux
  rootless: true
  uptime: 16h 50m 15.07s (Approximately 0.67 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /home/bkelly/.config/containers/storage.conf
  ContainerStore:
    number: 5
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mount_program=/usr/bin/fuse-overlayfs
  GraphRoot: /home/bkelly/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 43
  RunRoot: /run/user/1000
  VolumePath: /home/bkelly/.local/share/containers/storage/volumes

Additional environment details (AWS, VirtualBox, physical, etc.):
Container created FROM fedora:30

Activity

  1. added
    kind/bug
    on Jun 24, 2019
  2. rhatdan commented on Jun 24, 2019

    @rhatdan
    Contributor

    It is SELinux.
    Volumes need to be mounted with the :Z flag, or you need to disable SELinux separation.
    --security-opt label:disable

  3. added
    locked - please file new issue/PR
    on Sep 24, 2023
  4. locked as resolved and limited conversation to collaborators on Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/buglocked - please file new issue/PR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions