gliderlabs / docker-alpine

Alpine Linux Docker image. Win at minimalism!
http://gliderlabs.viewdocs.io/docker-alpine
BSD 2-Clause "Simplified" License
5.7k stars 529 forks source link

adduser mangling /etc/passwd at new user shell #141

Open rootwyrm opened 8 years ago

rootwyrm commented 8 years ago

Caught me off guard, this. Definitely a bug.

FROM gliderlabs/alpine:latest
Step 5 : ENV lxcuser "lxcmedia" lxcuid "1024" lxcgroup "users" lxcgid "100"
Step 15 : RUN adduser -h /home/$lxcuser -g "lxc-media user" -u $lxcuid -G $lxcgroup -D $lxcuser

This translates into the (triple-checked) command adduser -h /home/lxcmedia -g "lxc-media user" -u 1024 -G 100 -D lxcmedia which should create the user with the default shell. Instead, what it does to /etc/passwd is this:

nobody:x:65534:65534:nobody:/:/sbin/nologin
lxcmedia:x:1024:100:lxc-media user:/home/lxcmedia:obody

This is busybox 8586 - https://bugs.busybox.net/show_bug.cgi?id=8586 - should be fixed in 1.24.1. Confirmed no reproduction on 1.24.1 with buildroot, but alpine is reproducing reliably.

andyshinn commented 8 years ago

Thanks for reporting. I guess the workaround is to explicitly set the shell? I follow up with Alpine team if no response to the BusyBox report in a week or two.

rootwyrm commented 8 years ago

Hey Andy, thanks for replying! That's the headscratcher part. I confirmed that busybox 1.24.1 outside of alpine didn't reproduce, but I'm having no luck finding the regression or the commit that may have addressed it. I show my alpine as 1.24.1 too.

Explicitly setting shell with -s definitely does work around it for now - was hoping it was a known issue. Alas! I'll do some more digging and see if I can find out what the exact difference going on here is since I have a known working 1.24.1.

andyshinn commented 8 years ago

Can you file a bug at https://bugs.alpinelinux.org/? Unfortunately, I'm not intimate enough with the BusyBox patches to figure out what might be going on.

rootwyrm commented 8 years ago

Sorry about the delay on my end. Opened Alpine issue 5083 for this one.