nerdexam
LPI

010-160 · Question #14

Which command adds the new user tux and creates the user's home directory with default configuration files?

The correct answer is B. useradd -m tux. useradd -m creates a new user account and their home directory, automatically populating it with default skeleton files from /etc/skel.

Security and File Permissions

Question

Which command adds the new user tux and creates the user's home directory with default configuration files?

Options

  • Adefaultuser tux
  • Buseradd -m tux
  • Cusercreate tux
  • Duseradd -o default tux
  • Epasswd -a tux

How the community answered

(27 responses)
  • B
    93% (25)
  • D
    4% (1)
  • E
    4% (1)

Why each option

useradd -m creates a new user account and their home directory, automatically populating it with default skeleton files from /etc/skel.

Adefaultuser tux

defaultuser is not a valid Linux command; no such utility exists in standard Linux distributions.

Buseradd -m tuxCorrect

The -m flag instructs useradd to create the home directory if it does not already exist and copy default configuration files from /etc/skel into it, giving the new user tux a properly initialized home environment from a single command.

Cusercreate tux

usercreate is not a valid Linux command; the correct utility for adding users is useradd (or adduser on Debian-based systems).

Duseradd -o default tux

The -o flag in useradd permits creation of a user with a non-unique (duplicate) UID and takes no 'default' argument; it has nothing to do with home directory creation.

Epasswd -a tux

passwd is used to set or change a user's password, not to create user accounts; -a is not a valid passwd option for user creation.

Concept tested: useradd -m flag for home directory creation

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

Topics

#useradd#user management#home directory

Community Discussion

No community discussion yet for this question.

Full 010-160 Practice