{"id":37,"date":"2013-09-25T11:39:49","date_gmt":"2013-09-25T09:39:49","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=37"},"modified":"2013-09-25T11:41:52","modified_gmt":"2013-09-25T09:41:52","slug":"configuring-a-static-ip-address","status":"publish","type":"post","link":"https:\/\/www.extradrm.com\/?p=37","title":{"rendered":"Default File Permissions Apache \/var\/www\/"},"content":{"rendered":"<div>\n<h2>Apache2 Permissions<\/h2>\n<p>www-data is a user\/group set created specifically for web servers. It should be listed in \/etc\/passwd as a user, and can be configured to run as another user in \/etc\/apache2\/apache2.conf.<br \/>\nBasically, it\u2019s just a user with stripped permissions so if someone managed to find a security hole in one of your web applications they wouldn\u2019t be able to do much. Without a lower-user like www-data set, apache2 would run as root, which would be a Bad Thing\u00ae since it would be able to do anything and everything to your system.<\/p>\n<p>Make sure the group is www-data on &#8216;\/var\/www&#8217;.<\/p>\n<div>\n<div>Code:<\/div>\n<pre>sudo chgrp www-data \/var\/www<\/pre>\n<\/div>\n<p>Make &#8216;\/var\/www&#8217; writable for the group.<\/p>\n<div>\n<div>Code:<\/div>\n<pre>sudo chmod 775 \/var\/www<\/pre>\n<\/div>\n<p>Set the GID for www-data for all sub-folders.<\/p>\n<div>\n<div>Code:<\/div>\n<pre>sudo chmod g+s \/var\/www<\/pre>\n<\/div>\n<p>Your directory should look like this on an &#8216;ls -l&#8217; output.<br \/>\ndrwxrwsr-x<\/p>\n<p>Last, add your user name to the www-data group (secondary group).<\/p>\n<div>\n<div>Code:<\/div>\n<pre>sudo useradd -G www-data [USERNAME]<\/pre>\n<\/div>\n<div>\n<div>Code:<\/div>\n<pre>sudo chown [USERNAME] \/var\/www\/<\/pre>\n<\/div>\n<p>You should now be able to SFTP to your server as your user name and upload to &#8216;\/var\/www&#8217; with no problems.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Apache2 Permissions www-data is a user\/group set created specifically for web servers. It should be listed in \/etc\/passwd as a user, and can be configured to run as another user in \/etc\/apache2\/apache2.conf. Basically, it\u2019s&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2843,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,209,14],"tags":[220,221],"youtube_video":null,"_links":{"self":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":0,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2843"}],"wp:attachment":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}