10

I just installed Arch reading from the Beginners' Guide on the Arch Wiki. Once I rebooted Arch, I logged into root then I added my own personal account: useradd fox then passwd fox and set my password for the account. Once I logged in with fox I was prompted with the error --fox: /home/fox: change directory failed: No such file or directory. Logging in with home = "/".

Why I'm receiving this error and how I can fix it?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
ErraticFox
  • 273
  • 2
  • 3
  • 10

2 Answers2

9

It's actually a SELinux issue. Not sure about Arch Linux's configuration but I encountered it when replacing my home directory with another (i.e. restoring it from a backup). You can check it yourselves with

ls -lZ /home

That prints out SELinux labels. Your home directory should have the user_home_dir_t label. The fix is straightforward:

restorecon -R /home

A longer discussion can be found in the Fedora forums.

saschpe
  • 199
  • 1
  • 3
7

You need to tell useradd to create your home directory:

useradd -m fox

You might also want to add options for group(s) -g -G, login-shell -s etc.

But don't worry - you can create your homedir now (as root using sudo or su):

# mkdir /home/fox
# chown fox:fox /home/fox

See Arch Linux Documentation - User Management

grebneke
  • 4,621
  • 25
  • 20
  • 1
    Ah, thank you! Is it actually _vital_ to do groups? – ErraticFox Mar 04 '14 at 13:57
  • @ErraticFox - No, I think the default for Arch is to create a group with the same name as the user, so your group is now most likely `fox`. For some applications it is necessary to add extra groups, like `audio`. Start simple and add if the need arises. You can check current group membership with either of the commands `groups` or `id` – grebneke Mar 04 '14 at 14:01