Can somebody please explain to me the exact differences between
useradd -b and
useradd -d in [Debian] Linux? Both seem to work quite similar to me, but then I spot differences that confuse me.
-b specifies the location of users' home directories. On your average Debian box, this will be
/home; you can change the default by editing
useradd will add the new username to this path to get the home directory. This means that if you do
useradd -b /somewhere ian
the new user's directory will be
-d sets the home directory explicitly, irrespective of defaults. So
useradd -d /somewhere-else/ian ian
then the user's home directory will be set to
Note that the directory will be set in the password file, but won't actually be created unless
-m is also specified (or the
CREATE_HOME setting is enabled in the defaults file).