3

I added several users to my server using useradd -d /home/<username> <username> . The users are able to log in and access their directories, but get Permission denied error messages when attempting to create files or directories.

I thought that associating a home/username directory with username gives them read/write permission, and that I don't have to use chmod to give the user permissions to their own home directory. Presumably I missed a step when creating the user account, please clarify.

Archemar
  • 31,554
mshpak
  • 33
  • 3

1 Answers1

3

You should use option -m to create the home dir when doing useradd. -d ... is only to override the default name for the home dir, which is the same as the one you actually gave. You need to chown name:name /home/name for each name now to recover.

-m is useful as it also copies some standard files into the home dir.

meuh
  • 51,383
  • OK, thanks. I thought that the -d argument would set permissions to the home directory. In any case, chown fixed the issue, my main concern was how to avoid having to do this in the future. – mshpak Sep 30 '15 at 15:24