Skip to content

Commit

Permalink
pkg/unshare: return true from IsRootless if user is not root
Browse files Browse the repository at this point in the history
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 <dfr@rabson.org>
  • Loading branch information
dfr committed Dec 9, 2023
1 parent fe00540 commit fe74836
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/unshare/unshare_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe74836

Please sign in to comment.