That's a very insightful question! While it's standard practice to use -m for human users, there are specific scenarios where you would purposefully omit it:
1. System or Service Accounts
This is the most common reason. Many software applications (like databases, web servers, or background services) need their own "user" to run for security reasons, but they don't need a personal folder to save documents or log in to a desktop.
- Example: A user named
nginxormysqloften doesn't need a/homedirectory.
2. Users with Remote or Shared Home Directories
In large companies or server clusters, home directories are sometimes stored on a central server (using a system called NFS).
- In this case, the administrator creates the user account locally but doesn't want a local folder created because the user will "mount" their remote home directory when they log in.
3. Custom Directory Locations
If you want the user's home directory to be somewhere else (not in /home/), you might skip -m and use the -d option to specify a custom path, or create it manually later.
- Example:
sudo useradd -d /data/projects/developer1 developer1
4. Temporary or Restricted Users
Sometimes you might create a user account strictly for a specific task (like transferring a single file via FTP) where you want to prevent them from having any persistent storage space on the system.
Summary Table:
| Scenario | Use -m? |
Why? |
|---|---|---|
| Normal Human User | Yes | They need a place to store files and settings. |
| System Service | No | It's more secure and saves space; they don't "log in." |
| Network/Shared Home | No | The home folder already exists on a different server. |
In your current lab, since you are learning to manage user accounts for people, you will mostly be using -m!