Can I specify a different home directory?

QuestionsQuestions8 SkillsProUser Account ManagementSep, 17 2025
0145

Yes, you can specify a different home directory for a user when using the useradd command by using the -d option.

Here’s the syntax:

sudo useradd -m -d /path/to/custom/home username

In this command:

  • -m creates the home directory if it does not exist.
  • -d /path/to/custom/home specifies the custom path for the home directory.

For example, to create a user named batman with a home directory at /home/gotham, you would use:

sudo useradd -m -d /home/gotham batman

0 Comments

no data
Be the first to share your comment!