Which command creates a new user with the comment field 'Sam Brown' and username sbrow?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which command creates a new user with the comment field 'Sam Brown' and username sbrow?

Explanation:
Setting the full name in the user account is done via the GECOS field. The -c option to the user creation command provides that value. In this example, the command creates a user named sbrow and assigns the string Sam Brown to the GECOS (comment) field. The quotes are needed because the name contains a space, ensuring the entire string is passed as one argument. If you want a home directory created automatically, you can add -m, but that’s optional for just setting the comment. The other options either use a different tool with different syntax, or would fail because the argument with spaces isn’t quoted, or misuse a command intended for password changes.

Setting the full name in the user account is done via the GECOS field. The -c option to the user creation command provides that value. In this example, the command creates a user named sbrow and assigns the string Sam Brown to the GECOS (comment) field. The quotes are needed because the name contains a space, ensuring the entire string is passed as one argument.

If you want a home directory created automatically, you can add -m, but that’s optional for just setting the comment. The other options either use a different tool with different syntax, or would fail because the argument with spaces isn’t quoted, or misuse a command intended for password changes.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy