I have a fresh installation of Ubuntu 10.10 Server w/ LAMP. I've created a new user account and added a public_html folder in their home directory. I installed and used Webmin to create a new VirtualHost and modified that host's DocumentRoot to /userfolder/public_html. In addition, I've properly symlinked the config file for that Vhost from sites-available to sites-enabled.

As of right now, I'm the only user on the server. If I want to add others (new user account, separate public_html directory), do I just repeat the process above? Or, are their security considerations? What permissions do these directories need (chown useraccount, chgrp www-data, chmod 755)? Can I apply umask 022 automatically to all new files/folders?

Thanks in advance for any help.


You have several questions so I will address them in a list.

  • Yes, repeating the process will work for additional users.
  • For every directory in the structure above the public_html directory, the last bit in the mode must be set (--------x) (as well as any other bits) i.e., if /home/joe/public_html is the dir., home must have atleast --------x and joe must have atleast --------x

  • /blah/foo/bar/public_html (and any subdirectories) must have atleast ------r-x

  • Files that should be web-accessible must be atleast ------r--
  • umask 022 will create directories rwxr-xr-x and files rw-r--r-- so this is fine

Some considerations:

  • If you are changing the group to www-data, you can use group permissions instead of other/world permissions above.
  • You don't need a vhost for every public_html, this just makes the URLs cleaner. If you don't create the vhost, the default way to access each user's site is http://your.site.tld/~username (This might still work even with vhosts. I've never actually used vhosts with users' public_html.

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.