Quando utilizziamo useradd , qual è la differenza tra -d e -m ? Perché le definizioni di entrambi suonano simili, il che è responsabile della creazione di una home directory.
Risposta accettata:
Le 2 opzioni non sono molto simili, ma possono funzionare insieme. Se guardi la manpage di useradd troverai quanto segue:
-d, --home-dir HOME_DIR
The new user will be created using HOME_DIR as the value for the user's login
directory. The default is to append the LOGIN name to BASE_DIR and use that as the
login directory name. The directory HOME_DIR does not have to exist but will not be
created if it is missing.
-m, --create-home
Create the user's home directory if it does not exist. The files and directories
contained in the skeleton directory (which can be defined with the -k option) will be
copied to the home directory.
By default, if this option is not specified and CREATE_HOME is not enabled, no home
directories are created.
Il -d l'opzione è solo quella di impostare dove sarà la home directory dell'utente creato ma non la creerà se non esiste. Mentre il -m l'opzione creerà la directory home impostata da -d se non esiste.