What if the directory exists?

QuestionsQuestions8 SkillsProUser Account ManagementAug, 28 2025
0114

If the home directory already exists when you use the useradd -m command, the command will typically not overwrite the existing directory. Instead, it will proceed to create the user account without modifying the existing directory.

However, the user will not have their home directory set up properly if the existing directory does not belong to them or if it contains files that are not appropriate for the new user. In such cases, you may want to manually check the contents of the directory or specify a different home directory using the -d option.

For example:

useradd -m -d /path/to/existing/directory username

This command will set the specified existing directory as the home directory for the new user.

0 Comments

no data
Be the first to share your comment!