Can useradd create directory recursively?

Solution Verified - Updated -

Issue

I was going to add user and create directory using useradd command, but an error occured with the following message:

# useradd -m -d /home/user/testuser1 testuser1
useradd: cannot create directory /home/user/testuser1

"/home/user" was not created, and I expected that "/home/user/ and "/home/user/testuser1" are created at rhe same time.

Environment

  • Red Hat Enterprise Linux 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content