Wenn wir useradd
verwenden , was ist der Unterschied zwischen -d
und -m
? Da die Definitionen von beiden ähnlich klingen, ist das Erstellen eines Home-Verzeichnisses verantwortlich.
Akzeptierte Antwort:
Die 2 Optionen sind nicht wirklich ähnlich, aber sie können zusammenarbeiten. Wenn Sie sich die Manpage von useradd
ansehen finden Sie Folgendes:
-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.
Das -d
Option ist nur, um festzulegen, wo sich das Home-Verzeichnis des erstellten Benutzers befinden wird, aber es wird nicht erstellt, wenn es nicht existiert. Während das -m
Option erstellt das Home-Verzeichnis, das durch -d
festgelegt wird wenn es nicht existiert.