useradd and Alpine Linux

Posted on June 4, 2017

While I’ve been using Alpine Linux more in the last year, I am still learning new things rather frequently.

Here is today’s discovery: If your ops tooling wants useradd, you’ll need to install the shadow package.

The reason is simple: Whereas most Linux distros are using PAM, Alpine is based on busybox, and has a different login stack (and related tooling, like adduser).

Note that, by installing the shadow package, you replace the busybox login stack with PAM, which means that you may find corner cases where the login semantics differ (eg: where the PAM policies differ from standard busybox stuff).