Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam XK0-005 topic 1 question 122 discussion

Actual exam question from CompTIA's XK0-005
Question #: 122
Topic #: 1
[All XK0-005 Questions]

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?

  • A. useradd -d /comptia/projects user02
  • B. useradd -m /comptia/projects user02
  • C. useradd -b /comptia/projects user02
  • D. useradd -s /comptia/projects user02
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
linux_admin
1 year, 2 months ago
Selected Answer: A
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.
upvoted 1 times
...
KnifeClown1
1 year, 2 months ago
Selected Answer: A
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.
upvoted 1 times
...
Ckl22
1 year, 4 months ago
Selected Answer: A
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
upvoted 3 times
...
tony12345
1 year, 4 months ago
D is the only correct answer!!!!! Noobz. Git good
upvoted 1 times
...
Notnotataco
1 year, 4 months ago
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
upvoted 1 times
Veteran903
1 year, 4 months ago
Im with you.....C
upvoted 1 times
...
Mathew89
4 months, 2 weeks ago
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
upvoted 1 times
...
...
TheRealManish
1 year, 4 months ago
Selected Answer: C
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
upvoted 1 times
Veteran903
1 year, 4 months ago
its C brother, run "man useradd" in your terminal and read on the -b option
upvoted 1 times
...
Nvoid
1 year, 4 months ago
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.
upvoted 2 times
TheRealManish
1 year, 4 months ago
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
upvoted 2 times
...
...
...
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.

SaveCancel
Loading ...