How do I add a user in Linux without a home directory?

While managing users, Linux administrators need to manage different types of users based on the privileges he/she wants to set. User management includes access control and Group management of the user. It is often seen that when we create users in Linux, there are two types of commands available useradd and adduser. We will add a user in Linux without a home directory using the useradd command in this post.

useradd Command

The useradd is a command used for creating a user in any Linux-based operating system. It is a low-level or less secure command for creating a user because it only creates a user until we specify a flag.

This command does not automatically create a home directory until a -m flag is specified.

Without a Home Directory flag

Moreover, this command also provides a flag or option if you do not want to create a home directory of a user while creating a user.

-M for creating a user without a Home directory
–no-create-home is also used for not creating a home directory of a user

For example,


$ useradd –no-create-home username>

Let’s do some practical, create users using the useradd command and witness it.

Create a user using the useradd Command

To create a user using the useradd command, type the command given below:

In the above command, Ivan is the username, so provide your username at the place of Ivan.

You can witness in the screenshot attached; the user is created without asking for any password.

To create a password for this user, execute the command given below:

Type the new password you want to set for the user:

After successfully creating a user and setting its password, log in to the user profile using the command given below:

Type the recently created password for the newly created user:

You can see we are logged in to Ivan’s shell, and you can also witness that the user does not have the home directory.

Wrap Up

User management is an extremely responsible task for any Linux administrator. Due to the security reasons and privileges of the users, Linux administrators have to create some users without a home directory. This article provides to-the-point detail for creating a user without a home directory.