When we use useradd
, what is the difference between -d
and -m
? Because the definitions of both sound similar, which is responsible for creating a home directory.
When we use useradd
, what is the difference between -d
and -m
? Because the definitions of both sound similar, which is responsible for creating a home directory.
The 2 options are not really similar, but they can work together. If you look at the manpage of
useradd
you'll find the following:The
-d
option is just to set where the home directory of the created user will be but it will not create it if it doesn't exist. While the-m
option will create the home directory that is set by-d
if it doesn't exist.