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.
Question
Options
- Adefaultuser tux
- Buseradd -m tux
- Cusercreate tux
- Duseradd -o default tux
- Epasswd -a tux
How the community answered
(27 responses)- B93% (25)
- D4% (1)
- E4% (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.
defaultuser is not a valid Linux command; no such utility exists in standard Linux distributions.
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.
usercreate is not a valid Linux command; the correct utility for adding users is useradd (or adduser on Debian-based systems).
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.
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
Community Discussion
No community discussion yet for this question.