Which command would you use to add a new user along with specific options for home directory and group?

Prepare for the LPI Linux Essentials Exam with our comprehensive quiz. Study with interactive flashcards and multiple choice questions, with detailed hints and explanations for each. Ace your exam with confidence!

The command used to add a new user with specific options like home directory and group is indeed useradd. This command allows for detailed configurations at the time of user creation.

When you run useradd, you can specify various options such as the user's home directory with the -d flag and the initial group with the -g flag. For example, using useradd -d /home/username -g groupname newusername creates a user named newusername with a specified home directory and group.

In contrast, groupadd is specifically for creating new user groups and does not deal with user accounts directly. The adduser command, while it does create users, is often a higher-level front-end to useradd in many Linux distributions, and its behavior can vary based on the system. It usually prompts for additional information interactively. The usermod command is utilized to modify details of existing users, such as changing their group or home directory, rather than adding new users.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy