Avatar of Williams225
 asked on

home directory is not created when i create a user (linux)


i am trying tocreate a user but the home directory is not created even when i do

useradd -d /home/user1 user1
LinuxUnix OS

Avatar of undefined
Last Comment

8/22/2022 - Mon

Your use of the -d flag is the issue
man useradd
Quoted from the man pages:
" -d, --home HOME_DIR
          The new user will be created using HOME_DIR as the value for the
          userâs login directory. The default is to append the LOGIN name to
          BASE_DIR and use that as the login directory name. The directory
          HOME_DIR does not have to exist but will not be created if it is
If you must use -d you must then use the -m option to have the directory created.

useradd -D
Will show you the default settings for user addition.
useradd user1
will add user1 and create based on the default settings.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

My answer pointed out the exact same thing.

yeah you right bro, I should have splitted the points. Sorry about that. Thanx for your help anyway
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck