Gice

Technology and General Blog

Linux is a highly effective multi-user working program. It can have lots of concurrent users accessing the system at the same time. The procedure admin can take care of permissions for each individual person to specify which person can entry what aspect of the procedure.

This tutorial will show how to generate a new person with a distinctive home directory in Linux.

Consumer residence directory

In Linux, every consumer gets its possess residence directory with exceptions like a variety of process accounts. The property directory is a committed directory for the certain person to retailer the user-certain information. It’s also referred to as the “login directory”. Every time logging in, the user will land on the respective house listing.

By default, all the consumers in the program have their dwelling directories positioned at the adhering to area.


Every home listing is named after the username of the user. For case in point, the household directory for the consumer “viktor” will seem like this.


Nevertheless, we can build a diverse place for the user listing. It can be set for the duration of the generation of the user account or moved later.

Building a user with a different household listing

Making a new person

Each Linux system arrives with useradd, a devoted software to develop and update user accounts. It is only obtainable to the root user and non-root consumers with sudo privileges.

To include a new person to the procedure, run the pursuing useradd command. The flag “-m” tells useradd to develop a focused dwelling directory for the new consumer. If not employed, then the consumer will not have a focused household directory.

$ sudo useradd -m <username>


The person is extra to the method. The consumer is also registered to many databases files (/and many others/passwd, /etcetera/shadow, /etcetera/gshadow, and /etcetera/group).

The user is not available nonetheless. The pursuing command will assign a login password for the new person.


The user is all set and entirely useful. Entry the new person.

Check out the locale of the property listing of the new user.

Building a user with a custom made property directory

By default, useradd will produce the user’s property directory less than “/home”. To specify the property directory in a different area, use the flag “-d”. Observe that the directory ought to exist beforehand.

$ sudo useradd -m -d <custom_home_dir_location> <username>


As always, use passwd to assign a login password for the new person.


Confirm if the new consumer has a distinctive property listing.

Going present user residence listing

We can also assign a distinctive house listing for an existing person. It will not shift the contents of the present home directory mechanically to the new location.

Build a new listing. It will be the new dwelling listing of an present person.

$ mkdir -pv /more/new_residence


Permit the new consumer comprehensive accessibility above the new listing.

$ sudo chown <username> /further/new_household


Go all the contents of the present consumer property listing to the new a single.

$ sudo mv /house/<username>/* /excess/new_residence

Assign the new listing as the home of the consumer.

$ sudo usermod -d /excess/new_residence -m <username>


Confirm the change.

Last ideas

The household directory is an essential portion of a ordinary user account on Linux. This guidebook demonstrates how to assign a custom household listing to a new and existing consumer. These techniques implement to any Linux distro.

Delighted computing!

Leave a Reply

Your email address will not be published. Required fields are marked *