Tuxtips - Linux HowTos

Linux HowTos live here

How to create a user with home directory in Linux

31 Jul 2020

In most cases whenever you install a Linux distribution the installer creates a user account with the data you provide (user name and password), but if you for example want to share your computer with another person, that person may want to have separate settings and working space. You need to add their account, together with home directory. And the terminal command is simple:

click code to copy
sudo useradd -m username

where username is the login your user will use on the machine. Of course you may omit sudo if you switch to root.
The newly created account does not have a password yet, so you can set it like this:

click code to copy
sudo passwd username

Again, substitute username with the name of the user you have just created. You will be prompted to enter the password and then to confirm it.
Your new user can now log in to the system and use their separate settings and home directory.
Comments Add your comment

Enter the digit "three" (spam protection):