CompTIA Linux+ (XK0-004) — Question 263

A Linux administrator is creating a new local Linux user account for a web application. The account has the following requirements:

• Use /var/www as the home directory
• Have the service_accounts group as its primary group
• Have the www user group as a secondary group
• Disable the account when the password expires

Which of the following BEST meets these requirements?

Answer options

Correct answer: D

Explanation

Option D is correct because it properly sets the home directory to /var/www/, assigns service_accounts as the primary group, adds www as a secondary group, and uses the -f flag to disable the account when the password expires. Option A incorrectly uses -D instead of -d for the home directory, Option B uses -f with an incorrect argument, and Option C also incorrectly uses -D instead of -d for the home directory.