diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index 70f6f741f5..65afbf0274 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -1917,15 +1917,6 @@ func (c *Container) makeBindMounts() error { return fmt.Errorf("assigning mounts to container %s: %w", c.ID(), err) } } - - if !hasCurrentUserMapped(c) { - if err := makeAccessible(resolvPath, c.RootUID(), c.RootGID()); err != nil { - return err - } - if err := makeAccessible(hostsPath, c.RootUID(), c.RootGID()); err != nil { - return err - } - } } else { if !c.config.UseImageResolvConf { if err := c.createResolvConf(); err != nil { diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index 548286af0f..d72f7eb14c 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -183,16 +183,14 @@ func hasCurrentUserMapped(ctr *Container) bool { // CreateContainer creates a container. func (r *ConmonOCIRuntime) CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) (int64, error) { - // always make the run dir accessible to the current user so that the PID files can be read without + // always make the container directory accessible to the current user so that the PID files can be read without // being in the rootless user namespace. if err := makeAccessible(ctr.state.RunDir, 0, 0); err != nil { return 0, err } if !hasCurrentUserMapped(ctr) { - for _, i := range []string{ctr.state.RunDir, ctr.runtime.config.Engine.TmpDir, ctr.config.StaticDir, ctr.state.Mountpoint, ctr.runtime.config.Engine.VolumePath} { - if err := makeAccessible(i, ctr.RootUID(), ctr.RootGID()); err != nil { - return 0, err - } + if err := makeAccessible(ctr.state.Mountpoint, ctr.RootUID(), ctr.RootGID()); err != nil { + return 0, err } // if we are running a non privileged container, be sure to umount some kernel paths so they are not