diff --git a/libpod/container_internal.go b/libpod/container_internal.go index d1eeb7f851..29a32a1c3c 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -544,16 +544,6 @@ func (c *Container) setupStorage(ctx context.Context) error { c.config.StaticDir = containerInfo.Dir c.state.RunDir = containerInfo.RunDir - if len(c.config.IDMappings.UIDMap) != 0 || len(c.config.IDMappings.GIDMap) != 0 { - if err := idtools.SafeChown(containerInfo.RunDir, c.RootUID(), c.RootGID()); err != nil { - return err - } - - if err := idtools.SafeChown(containerInfo.Dir, c.RootUID(), c.RootGID()); err != nil { - return err - } - } - // Set the default Entrypoint and Command if containerInfo.Config != nil { // Set CMD in the container to the default configuration only if ENTRYPOINT is not set by the user. diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index 65afbf0274..216074e130 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -1834,10 +1834,6 @@ func (c *Container) mountIntoRootDirs(mountName string, mountPath string) error // Make standard bind mounts to include in the container func (c *Container) makeBindMounts() error { - if err := idtools.SafeChown(c.state.RunDir, c.RootUID(), c.RootGID()); err != nil { - return fmt.Errorf("cannot chown run directory: %w", err) - } - if c.state.BindMounts == nil { c.state.BindMounts = make(map[string]string) } diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index d72f7eb14c..ff0e790860 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -183,11 +183,6 @@ func hasCurrentUserMapped(ctr *Container) bool { // CreateContainer creates a container. func (r *ConmonOCIRuntime) CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) (int64, error) { - // 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) { if err := makeAccessible(ctr.state.Mountpoint, ctr.RootUID(), ctr.RootGID()); err != nil { return 0, err