0

I'm trying to set up a git user, but am getting the error

useradd: cannot create directory /srv/data/git when running this command

sudo useradd                      \
  --create-home                   \
  --skel      /dev/null           \
  --home-dir  /srv/data/git       \
  --shell     /usr/bin/git-shell  \
  --comment   'Web Archive VCS'   \
git

Why am I having trouble? When creating the directory first, (mkdir -p /srv/data/git) I receive the following two errors/warnings.

useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.

This should be very straight forward, but is having issues for unknown reasons to me

1 Answer 1

1

It looks like useradd uses mkdir or something akin to if WITHOUT the -p flag, this means that the directory MUST exist up to the last portion of the path. This seems like a functionality gap.

In order to fix the above, I/you will need to mkdir -p /srv/data before running the switch for ... --create-dir --home-dir /src/data/git ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .