"Could not chdir to home directory /home/me: No such file or directory"

94,936

adduser is too basic and doesn't set the defaults properly. It's recommended to use useradd whenever is possible. You can remove the new user and create it again with useradd -D me or repair it yourself:

sudo mkdir /home/me
sudo usermod --shell /bin/bash --home /home/me me
sudo chown -R me:me /home/me
cp /etc/skel/.* /home/me/

If you had used getent passwd me as Florian suggested you should have seen something like this:

sudo getent passwd me
boggus:x:1002:1002::/home/me:/bin/sh

And ls /home wouldn't shown the user directory as your error:

Could not chdir to home directory /home/me: No such file or directory
Share:
94,936

Related videos on Youtube

ddd
Author by

ddd

Updated on September 18, 2022

Comments

  • ddd
    ddd over 1 year

    I am using 12.04 on my server.

    I created a new user using adduser me and passwd me and added it to sudo.

    When I log in this is what I see.

    Could not chdir to home directory /home/me: No such file or directory    
    $
    

    I type bash and it begins to look "normal"

    $ bash
    me@server:/$
    

    How can I avoid typing bash every time I login?

    • MattDMo
      MattDMo over 10 years
      how did you create the new user?
    • ddd
      ddd over 10 years
      that answer is not at all related to this question and does not help me.
    • Braiam
      Braiam over 10 years
      What command you used to create the user? Also add to your question the output of cat /etc/passwd.
    • ddd
      ddd over 10 years
      adduser me, passwd me
    • Christopher B. Adkins
      Christopher B. Adkins over 10 years
      Please add the output of getent passwd $USER to your question
  • ddd
    ddd over 10 years
    however at the last step I get cp: cannot stat /etc/skel/*': No such file or directory` what does this do?
  • ddd
    ddd over 10 years
    when I do useradd -D me it just outputs list of arguments. I have ran userdel me before
  • Braiam
    Braiam over 10 years
    Please, edit your question and add the output of apt-cache policy passwd.
  • ddd
    ddd over 10 years
    following this instruction did not successfully resolve the problem.
  • Braiam
    Braiam over 10 years
    @ddd but then tell what went wrong... edit your question and add the information...
  • Egwor
    Egwor over 4 years
    @ddd you missed the '.'. What you needed to do was cp /etc/skel/.* /home/me/ not cp /etc/skel/* /home/me/
  • Shannon
    Shannon almost 4 years
    @Braiam, I had similar issue and went through your instruction. The last line(cp /etc/skel/.* /home/me/) gives me error: 1. cp: -r not specified; omitting directory '/etc/skel/.' 2. cp: -r not specified; omitting directory '/etc/skel/..' any idea?