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

I run a LAMP server on a ubuntu laptop I use only for development. I am not greatly concerned with security, since the server is never accessible outside the local network, and it's turned off when I'm not using it.

My question is what is the simplest and 'best' way to set permissions/users/groups so that when my myself user creates, edits or writes files in the webroot, I won't need to go through and CHMOD / CHOWN everything back to the www-data user?

Should I add myself to the www-data group? Or chown the webroot to www-data:myself? Or is there a best practice for this situation so I don't have to keep re-setting the ownership of these files?

Thanks

EDIT:

Perhaps it would help to note that I use PHP CMS systems like wordpress pretty extensively-- so it's important that the webserver "user" should be able to write new files-- since otherwise it would not be able to install new plugins, templates etc. in a web directory owned by a user.

share|improve this question

closed as off topic by SvW, Michael Hampton, Scott Pack, sysadmin1138 Nov 4 '12 at 2:13

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
While we do have tips for securing a LAMP server (serverfault.com/q/212269) for production, we don't have them for development servers. –  sysadmin1138 Nov 4 '12 at 2:13
add comment

1 Answer

With default umask (022) there's no need to chmod/chown files in order to view them via apache.

share|improve this answer
    
Right, but won't the Apache user be unable to write any files in a directory that myself has created? So the myself-owned files and dirs will be readable but not writeable by www-data? –  user101289 Nov 3 '12 at 23:02
    
Ordinarily, you do not want www-data or nobody to have write access to your static web content directories, for fairly obvious reasons. –  Skyhawk Nov 3 '12 at 23:33
    
IN the case of a PHP CMS (which I use pretty frequently) the apache user will be writing all kinds of files into the web directory when you install new WP themes, updates, etc. –  user101289 Nov 3 '12 at 23:38
    
If you're really lazy you might set umask to 0 in $HOME/.bashrc, but I didn't tell you this. –  FINESEC Nov 3 '12 at 23:47
add comment

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