CompTIA Linux+ (XK0-005) — Question 75
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?
Answer options
- A. useradd -d /comptia/projects user02
- B. useradd -m /comptia/projects user02
- C. useradd -b /comptia/projects user02
- D. useradd -s /comptia/projects user02
Correct answer: A
Explanation
The correct command is A, as the -d option specifies the home directory for the new user. Option B uses -m, which creates a home directory but does not set it to the specified path. Option C with -b sets the base directory for users but does not define a specific home directory. Option D uses -s, which is for setting the user's shell, not their home directory.