Cuando usamos useradd
, cuál es la diferencia entre -d
y -m
? Debido a que las definiciones de ambos suenan similares, lo cual es responsable de crear un directorio de inicio.
Respuesta aceptada:
Las 2 opciones no son realmente similares, pero pueden funcionar juntas. Si miras la página de manual de useradd
encontrará lo siguiente:
-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.
El -d
La opción es solo establecer dónde estará el directorio de inicio del usuario creado, pero no lo creará si no existe. Mientras que el -m
La opción creará el directorio de inicio que se establece mediante -d
si no existe.