How to create a user in Linux with a specified home directory?
To create a new user and specify their home directory, you can use the useradd command with the -d parameter to specify the path of the home directory. Here is an example command to create a user named newuser with the home directory set to /home/newuser:
sudo useradd -m -d /home/newuser newuser
In this command, the -m flag will automatically create a home directory for the new user, while the -d flag specifies the path of the home directory as /home/newuser. You can also customize the home directory path as needed.