I have created user by "useradd " the user created and created password using "passwd" command and able to login as newuser but while it type "cd" it says /home/newuser no file or directory found.

Anyone guide I need to manually create new directory every time I add user on that specific username?

  • Did you use the -m flag with useradd? Like: useradd -m -s /bin/bash username – cylgalad Jan 6 '18 at 9:14

MAN useradd/adduser:

-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 missing.

Alternatively check how adduser behaves on your system. You can usually ask them for information on how they work by using --help or similar as the parameter.

Check Create the home directory while creating a user [duplicate]. If you're running a debian flavor adduser and useradd are different things. Check their parameters individually on your system.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.