2

The command useradd new will create the /home/new directory.

Is there a way to create the /home/new and /home/new/check directories when useradd new is executed?

I don't want to write two commands for the job every time I create a new user.

useradd new
mkdir /home/new/check
1
  • In additon to the answer below about putting files/directories in /etc/skel consider using adduser instead of useradd - unless you are creating accounts with a script... Commented Oct 30, 2017 at 11:59

1 Answer 1

10

The template used when creating a new home directory is in /etc/skel. Simply create the directory there and all new users will have it.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.