Support `useradd` arguments, or system flag
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 357
- PR merge metrics
- No merged PRs in 30d
Description
The command to create a local user is hardcode to `useradd -m` in https://github.com/aws/amazon-ssm-agent/blob/mainline/agent/session/utility/model/model_unix.go#L21 ( and then used at https://github.com/aws/amazon-ssm-agent/blob/mainline/agent/session/utility/utility_unix.go#L116 ).
It may be useful to allow any argument to `useradd` here, but our immediate use is that the argument `-r` or `--system` be used, so that the UID and GID are created in the range `SYS_UID_MIN` to `SYS_UID_MAX` (typically `100` to `999`).
In our environment, we have UIDs/GIDs above that range (the `UID_MIN` being `1000`) so there can be conflicts depending on when users/groups were created. (To be more clear, because most of our users and groups don't come from `/etc/passwd`).
If not a way to specify arguments to `useradd`, is there a reason to _not_ use the `-r` / `--system` flag for `ssm-user`? The major distributions supported by SSM Agent all support the `-r` / `--system` flag.
Contributor guide
Research direction
Start by reading agent/session/utility/model/model_unix.go and agent/session/utility/utility_unix.go to trace how the hardcoded useradd -m command is built and used. Compare configurable arguments with the requested -r/--system behavior; done means the selected useradd options are applied during ssm-user creation without the stated UID/GID conflicts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100