fix: use effective uid instead of uid

This commit is contained in:
2026-02-03 16:22:26 +02:00
parent 5738b8b911
commit 389bad6725
4 changed files with 11 additions and 11 deletions

View File

@@ -192,7 +192,7 @@ def check_user(root: Path, *, unsafe: bool) -> None:
if unsafe:
return # unsafe flag is enabled, no check performed
current_uid = os.getuid()
current_uid = os.geteuid()
root_uid, _ = owner(root)
if current_uid != root_uid:

View File

@@ -239,7 +239,7 @@ class RepositoryPaths(LazyLogging):
# the reason we do this is that it only works if permissions can be actually changed. Hence,
# non-privileged user (e.g. personal user or ahriman user) can't change permissions.
# The only one who can do so is root, so if user is not root we just terminate function
current_uid, current_gid = os.getuid(), os.getgid()
current_uid, current_gid = os.geteuid(), os.getegid()
if current_uid != 0:
yield
return