It is best to use adduser for ubuntu users. Although adduser and useradd are the same in other linux operating systems, the user home directory with the same name is not created when I use useradd In ubuntu.
Example: adduser user1
In this way, the user's home directory will be automatically created to create a group with the same name as the user.
If you have deleted the home directory and have not deleted the user, you can use the following command to recreate the home directory.
Sudo mkdir/home/user # Here, the user in/home/user should be the same as your original user name.
Sudo chown-R user: user/home/user # Here the user: user should be changed to your previous "user name: user Group" Format
Sudo chmod-R 755/home/user # grant permissions to 755
755 can be viewed and executed by users in other groups in the same group. If you do not want to view the permissions of users in the same group or other groups, you can set the permission to 700.
Author ylq365