Skip to content

Conversation

adombeck
Copy link
Contributor

@adombeck adombeck commented Sep 24, 2025

Support setting the UID of a user via authctl user set-uid <user> <uid>.

Also changes the owner and group of the user's home directory and all files in the home directory from the old UID and GID to the new UID and GID (if it is owned by the current user), same as usermod does when changing the UID of a user.

Closes #630
UDENG-7717

There's nothing encrypted in this string.
... instead of prefixing the error message with "permission denied"
Required to change the ownership of the user's home directory when
changing the user's UID.
We use this to recursively change the owner and group of the user's home
directory when changing the user's UID.

WIP because there are no tests yet.
Do the same usermod does when changing a UID of a user: If the home
directory is currently owned by the user, recursively change the owner
and group of the home directory and all files in the home directory from
the old UID and GID to the new UID and GID.

WIP because there are no tests yet
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 5.40541% with 105 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.41%. Comparing base (89f25b4) to head (07b3b86).
⚠️ Report is 58 commits behind head on main.

Files with missing lines Patch % Lines
internal/users/db/update.go 0.00% 33 Missing ⚠️
internal/users/manager.go 11.76% 30 Missing ⚠️
cmd/authctl/user/set-uid.go 0.00% 15 Missing ⚠️
internal/fileutils/fileutils.go 0.00% 15 Missing ⚠️
internal/services/user/user.go 0.00% 11 Missing ⚠️
internal/services/permissions.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1087      +/-   ##
==========================================
- Coverage   88.06%   86.41%   -1.66%     
==========================================
  Files          85       90       +5     
  Lines        6041     6248     +207     
  Branches      111      111              
==========================================
+ Hits         5320     5399      +79     
- Misses        665      793     +128     
  Partials       56       56              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support setting UID and GID via authctl

2 participants