Adding Users and Creating Home Directory in Ubuntu

So it turns out that if you just issue useradd command in your linux machine you will create a user but there will be no home directory. Th problem the added user will not be able to login in his home directory. He can login using cli but not otherwise. So here is how to create user home directory when adding a user


sudo useradd -d /home/testuser -m testuser

sudo passwd testuser

 

this is a as simple as that and another way is using the adduser command in which you can add more detail for the user like phone number and all.

Advertisements