Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.
share|improve this answer
    
Thanks, great tips. –  Trent Scott May 12 '11 at 17:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.