Skip to content

Commit

Permalink
Merge pull request #15 from desultory/dev
Browse files Browse the repository at this point in the history
set default uid map to 100000:65536 for root
  • Loading branch information
desultory authored Dec 31, 2024
2 parents 8a65551 + 811ed73 commit bd9ee5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/zenlib/namespace/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def get_id_map(username=None, id_type="uid"):
if id_type not in ("uid", "gid"):
raise ValueError("id_type must be 'uid' or 'gid'")

if getuid() == 0:
return 100000, 65536 # Not usre about this, unshare --map-auto --map-root seems to do this if run as root

with open(f"/etc/sub{id_type}") as f:
for line in f:
if line.startswith(f"{username}:"):
Expand Down

0 comments on commit bd9ee5e

Please sign in to comment.