A Linux administrator needs to create a new user named user02. However, user02 must be in a different home directory, which is under /comptia/projects. Which of the following commands will accomplish this task?
The command that can be used to create a new user named user02 with a different home directory under /comptia/projects is option A, useradd -d /comptia/projects user02.
The -d option is used to specify the home directory of the new user. By default, the useradd command creates the home directory of the new user in /home. To specify a different home directory for the new user, the -d option should be used, followed by the path to the new home directory.
A. useradd -d /comptia/projects user02
The command useradd -d /comptia/projects user02 will create a new user named user02 and set its home directory to /comptia/projects/user02. The -d option is used to specify the home directory for the user. The useradd command is used to add a new user to the system, and it creates the user's home directory by default, so there is no need to use the -m option in this case.
Answer is A
-d, --home HOME_DIR
The new user is created using HOME_DIR as the value for the user's login directory. The default is too 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 is not created if it's missing.
-b, --base-dir BASE_DIR
https://www.computerhope.com/unix/useradd.htm
https://unix.stackexchange.com/questions/83930/difference-between-useradd-b-and-useradd-d
I really think the way this question is worded, the correct answer is C. How I'm reading it, it implies that /CompTIA/projects already exists and we just need to add this new user to that directory instead of the /home directory. The -d option creates a new directory, the -b option creates a directory for the user at the specified target
I think I'm going to have to agree with C as well. The -d flag sets the explicit directory so in this case that users home would be /comptia/projects NOT /comptia/projects/user02
the wording on this one is really a problem. -d will store the users contents directly in the /compta/projects folder. the -b will create a comptia/projects/user2 folder and put it there. by the wording using the word UNDER, and sort of so simple logic, it seems like we should do C and have the -b option create /comptia/projects/user2
naw have a look at this:
https://linux.die.net/man/8/useradd
if you specify `-b` the directory must exist or you must supply `-d` as well.
I went with A or B
-d won't create the home directory but -m will, so i think it's -m but for some reason i want to go with A.
Thanks for helping me look at this again. I tried all of the options
-d : created the /comptia/projects folder and set user folder to /comptia/projects
-m : useradd -m is not valid.. even though -m is an option, it does not seem to work solo
-b : this created a folder called user2 in /comptia/projects and assigned that as the user homedir
-s : sets the shell
B doesn't work. so that brings us back to what is being asked here. is it asking us to assign the user home dir to /comptia/projects? then it's a. if it's asking to assign the homedir to /comptia/projects/user2, then it's c
its C brother, run "man useradd" in your terminal and read on the -b option
upvoted 1 times
...
...
This section is not available anymore. Please use the main Exam Page.XK0-005 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.
linux_admin
1 year, 2 months agoKnifeClown1
1 year, 2 months agoCkl22
1 year, 4 months agotony12345
1 year, 4 months agoNotnotataco
1 year, 5 months agoMathew89
5 months agoVeteran903
1 year, 5 months agoTheRealManish
1 year, 5 months agoNvoid
1 year, 5 months agoTheRealManish
1 year, 5 months agoVeteran903
1 year, 5 months ago