[systemd-devel] Enter in systemd-nspawn as specific user

Miroslav Suchy msuchy at redhat.com
Thu Oct 2 03:48:31 PDT 2014


On 10/02/2014 11:49 AM, Lennart Poettering wrote:
> There's nspawn's --user= switch which relies on glibc's "getent"
> binary to be available in the container, which it will use to resolve
> the username in the container's context and then change to it.

Perfect!

However if I do:
# /usr/bin/systemd-nspawn -D ./
  # /usr/sbin/useradd  -m  foobar
  Ctrl+D
# /usr/bin/systemd-nspawn -D ./ --user foobar
Spawning namespace container on /tmp/test (console is /dev/pts/15).
Init process in the container running as PID 16099.
mkdir_safe_label() failed: File exists
Container failed with error code 1.

If I did not let 'useradd' create home directory, then it succeed. Even
on second run, when the home directory exist (as created by
systemd-nspawn on first run).

Is this expected?

Mirek


More information about the systemd-devel mailing list