The -m option in the useradd command is used to create a home directory for the new user. When you specify -m, the command will automatically create a directory in /home with the same name as the user being added, and it will set up the necessary default files and directories within that home directory.
Example Usage
Here’s how you would use the -m option:
sudo useradd -m newuser
In this example, a new user named newuser will be created, and a home directory at /home/newuser will be created as well.
Additional Notes
- If you do not use the
-moption, the home directory will not be created, and the user will not have a designated home directory unless specified otherwise. - You can also customize the home directory location using the
-doption along with-m.
Feel free to ask if you have more questions about user management in Linux!
