FILL BLANK - What option to useradd creates a new user's home directory and provisions it with a set of standard files? (Specify only the option name without any values or parameters.)
-m is correct because the main point in the description is - in the skeleton directory:
-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.
From the question we have - and provisions it with a set of standard files?
Answer: -m
-m options will create the directory. -d option needs an already created directory
The question asks for a option that creates a new home's directory with a set of default files...
-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.
useradd will create the home directory unless CREATE_HOME in /etc/login.defs is set to no.
-d, --home 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.
Source: linux.die.net/man/8/useradd
I don't understand why everybody is pointing the correct answer '-m'
And the actual answer '-D' is not corrected ??? No one is bothering change it.
Why I paid 32$ in order to see the entire test results ???
Answer is - m
"-m
Create a new user account with its home directory (if it does not exist)."
https://learning.lpi.org/en/learning-materials/102-500/107/107.1/107.1_01/#:~:text=option%20is%20specified).-,%2Dm,account%20with%20its%20home%20directory%20(if%20it%20does%20not%20exist).,-%2DM
-D is wrong
"–D
Display the default values"
https://docs.oracle.com/cd/E88353_01/html/E72487/useradd-8.html#:~:text=on%20/home/%20username.-,%E2%80%93D,Display%20the%20default%20values,-for%20group%2C%20base_dir
The correct answer is -m
From the MAN pages of useradd:
...
OPTIONS
-D, --defaults
See below, the subsection "Changing the default values".
...
Changing the default values
When invoked with only the -D option, useradd will display the current
default values.
....
-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 is just print or change default values (not create any folder)
-m will surely create home directory even if not existed, and that folder will include all standard files or folder from SKEL folder.
Answer should be - "-m"
Definitely -m creates Home directory - see below options as per man page and for those say -D obviously have no clue as it prints out the default values that will be assigned to the user once created..What they should have said is NOT -D but -d, when using -d yes you create home directory for user BUT only used when you want to specify home directory for user NOT in traditional location i.e. /home and not with username, so something like /usr/MaxHome then you can use the -d but the question did not say that and said home directory and hence -m
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new account
-G, --groups GROUPS list of supplementary groups of the new account
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as the user
-D, --defaults print or change default useradd configuration
-d, --home-dir HOME_DIR home directory of the new account
-m, --create-home create the user's home directory
So, in my opinion, it should be "-m"
I don't agree with -D , the man page just says See below, the subsection "Changing the default values". So it seems you have to have another parameter with the -D and the list given doesn't mention anything about adding a set of standard files. I think it could be -md
When invoked without the -D option, the useradd command creates a new user account using the values specified on the command line plus the default values from the system.
Right answer it is -D
If, we can assume that the configuration file of useradd (/etc/defaults/useradd) has not been edited, then we must FORCE useradd to create a home directory by default by using the '-m' option to OVERRIDE defaults.
$ sudo useradd -m test
If the Linux administrator has defined the defaults in the (/etc/defaults/useradd), where the admin wishes to create a home directory for every user, then it is safe to use the -D option.
# useradd --heip
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-m, --create-home create the user's home directory
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
fantomas3239
Highly Voted 3 years agoyigido
Highly Voted 3 years, 4 months agoBrascoChe
Most Recent 3 months agok3n_
9 months, 3 weeks agok3n_
10 months, 3 weeks agoStormy_Cloud
10 months, 3 weeks agomatthew_perry
8 months, 3 weeks agodrliu1202
1 year, 5 months agolucaverce
1 year, 7 months agoKiddyLitty
1 year, 8 months agoKiddyLitty
1 year, 8 months agoLazylinux
1 year, 8 months agoLazylinux
1 year, 8 months agowvdw1962
1 year, 10 months agoRobert12
1 year, 11 months agoTheChild
1 year, 12 months agoCuriousLinuxCat
2 years, 5 months agoChenar
2 years, 7 months agoRini_Giannenzo
3 years agosugisho
3 years, 2 months ago