title: Permissions for /var/www/html
body: <p>I have a virtual CentOS server with GoDaddy, and I'm having trouble setting up the permissions for <code>/var/www/html</code>.</p>
  
  <p>Users are not allowed to log in as <code>root</code>, or even add themselves to the <code>root</code> group, so here's the corner I've painted myself into:</p>
  
  <ul>
  <li><p>I changed its owner using the following command (I used the user:group that was in <code>httpd.conf</code>):</p>
  
  <pre><code>chown -R apache:apache /var/www/html
  </code></pre></li>
  <li><p>I added my own user to the <code>apache</code> group:</p>
  
  <pre><code>usermod -a -G apache myuser
  </code></pre></li>
  <li><p>I changed the permissions:</p>
  
  <pre><code>chmod 777 /var/www/html -R
  </code></pre></li>
  </ul>
  
  <p>This is the only way to give my SFTP account the ability to create, change, <em>and</em> delete files in <code>/var/www/html</code>. 777! (The SFTP account uses the same credentials as the ssh account, which means for all intents and purposes they're the same, right?)</p>
  
  <p>I'm obviously new to Linux server admin, but this seems ridiculously insecure. Is there a better way to do all this?</p>
  
  <p><strong>Note</strong> The website I'm planning on putting up here will allow file uploads, cron jobs, etc., so I'm guessing that will complicate the necessary permissions as well. Is that correct?</p>
  
  <p><strong>Update</strong> Using 775 does not appear to work; I can upload/overwrite files, but when I just try to delete them, FileZilla gives me this error:</p>
  
  <blockquote>
    <p>rm /var/www/html/index.php: permission denied</p>
  </blockquote>
  
  <p>I have no idea why, but changing back to 777 "fixes" this.</p>