1

I created a user, then using root I created a folder for him. The folder has the same name as the user.

When I am logged in as the user, I cannot create files or edit existing ones without using sudo. I used the command useradd elephant then created a password for him using passwd elephant.

I'm running a fresh install of Arch Linux. Is there anything obvious that I am forgetting?

  • 1
    Did you chown the folder over to the new user? – ewhac Jun 19 '14 at 23:28
  • @ewhac that was the obvious sort of thing that I was looking for. Looks like I still have a bit to learn... Well, practice makes perfect. Sorry for wasting your time. Thanks a bunch! One last question, how do I mark this as solved? – Elephant454 Jun 19 '14 at 23:34
  • You accept the correct answer by upvoting it and clicking the green arrow underneath it... – jasonwryan Jun 19 '14 at 23:42
4

To add a user with his home directory automatically, adduser is the correct command, while it creates user, home directory, allows you to set password in that moment & let you set more info about the user (full name, address, phone, etc). I recommend you to remove the user, remove the created dir and run this command of course as root.

# userdel 'user'
# rm -rf /home/user_dir
# adduser 'user' (follow instructions)
# ls -ltr /home
  drwxr-xr-x user user size date  user_dir

Or you could also change owner to your created dir

# chown -R user:user user_dir

NOTE: -R to change all inside dirs/files owner -R = recursive

UPDATE: This works specifically in Ubuntu

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.