boxboat/fixuid

Rename username to $USER environment variable

cerna opened this issue · 1 comments

cerna commented

Hello,
I maintain application which uses Docker images for build and testing separation. It is invoking docker run with --user option to run with calling user UID and GID credentials. So far it looks like the fixuid is a good fix for that. But it is also passing -e "USER=$($USER)" on the docker run, so inside container the echo "$USER" and whoami differs. (And then $HOME, of couse.) As I discovered that Fixuid does not rename the user, at least not out of the box, I wanted to ask, can Fixuid somehow do it? Or what would be the best place to hack it in? The fixuid entrypoint?

Thanks.

Manipulating the user name, group name, and home directory is out of scope for this project right now. Mainly due to the fact that all of the variables that it takes into account are set at build time in /etc/fixuid/config.yaml, and this solution requires providing information that is not known until runtime.

If you want to fork and add this logic for your use case, I think it would be best after changing file ownership but before setting the updated home directory:

fixuid/fixuid.go

Lines 254 to 257 in 8d82f12

}
// mark the script as ran
if err := ioutil.WriteFile(ranFile, []byte{}, 0644); err != nil {