nerdexam
LPI

010-100 · Question #6

What command line will create the user falco with home directory assigned to the group users as primary group?

The correct answer is C. useradd -m -g users falco. The useradd command requires -m to create the home directory and -g to set the primary group, making option C the only syntactically correct command.

Configuration

Question

What command line will create the user falco with home directory assigned to the group users as primary group?

Options

  • Auseradd -g users falco
  • Buseradd -f users falco
  • Cuseradd -m -g users falco
  • Dadd user falco@users
  • Eadd -user falco -group users

How the community answered

(26 responses)
  • A
    15% (4)
  • B
    4% (1)
  • C
    73% (19)
  • D
    8% (2)

Why each option

The useradd command requires -m to create the home directory and -g to set the primary group, making option C the only syntactically correct command.

Auseradd -g users falco

Option A uses -g to set the primary group correctly but omits -m, so no home directory is created for the user.

Buseradd -f users falco

The -f flag in useradd sets the number of days after a password expires before the account is disabled, not the primary group.

Cuseradd -m -g users falcoCorrect

The -m flag instructs useradd to create the user's home directory if it does not exist, and the -g flag sets the primary group by name or GID. Together, 'useradd -m -g users falco' satisfies both requirements stated in the question.

Dadd user falco@users

'add user' is not a valid Linux command; the correct utility is useradd (or adduser on some distributions with different syntax).

Eadd -user falco -group users

'add -user' is not a valid command or option syntax on any standard Linux distribution.

Concept tested: useradd flags for home directory and primary group

Source: https://man7.org/linux/man-pages/man8/useradd.8.html

Topics

#useradd#home directory#primary group#user management

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice