From fe7483633a1d44da9e590a9902561a9a0d97aa03 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sat, 9 Dec 2023 10:28:26 +0000 Subject: [PATCH] pkg/unshare: return true from IsRootless if user is not root This helps to avoid a confusing error on FreeBSD when commands such as 'podman run' are attempted by a non-root user. Changing IsRootless to return true for these users allows types.DefaultConfigFile to return a user-accessible path for storage.conf which, in turn, allows 'podman run' to get as far as SetupRootless which will generate a more informative message than 'Error: stat /var/db/containers/storage/libpod/bolt_state.db: permission denied' Signed-off-by: Doug Rabson --- pkg/unshare/unshare_unsupported.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/unshare/unshare_unsupported.go b/pkg/unshare/unshare_unsupported.go index 83de680c20..e3160d0da9 100644 --- a/pkg/unshare/unshare_unsupported.go +++ b/pkg/unshare/unshare_unsupported.go @@ -17,7 +17,7 @@ const ( // IsRootless tells us if we are running in rootless mode func IsRootless() bool { - return false + return os.Getuid() != 0 } // GetRootlessUID returns the UID of the user in the parent userNS