LPI Linux Essentials (D281 and C851) Practice Exam

Session length

1 / 20

Which option can be used with useradd to specify the home directory for a user?

-d

The option that can be used with the useradd command to specify the home directory for a user is -d. This flag allows you to define a specific path that will serve as the user's home directory when the account is created. For example, if you wanted to create a new user with a custom home directory, you would use the command like this:

```bash

useradd -d /custom/home/directory username

```

This ensures that the user’s files and configurations are stored in the specified directory rather than the default location, which is typically "/home/username".

The other options, while relevant in other contexts, do not serve this specific purpose. The -c option is used to add a comment, typically for a full name or description of the user; -b is for specifying the base directory for the user’s home directory (which is less specific than -d); and -h is not a standard option for useradd. Thus, -d is the correct choice for designating a user’s home directory.

-c

-b

-h

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy