useradd
を使用する場合 、-d
の違いは何ですか および-m
?どちらの定義も似ているように聞こえるので、ホームディレクトリの作成を担当します。
承認された回答:
2つのオプションは実際には似ていませんが、一緒に機能することができます。 useradd
のマンページを見ると 次のようなものがあります:
-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.
-d
オプションは、作成されたユーザーのホームディレクトリを設定するだけですが、ホームディレクトリが存在しない場合は作成されません。 -m
オプションは、-d
によって設定されるホームディレクトリを作成します 存在しない場合。