Setting File Permissions
52 views
Website Management
<h3>Understanding File Permissions</h3>
<p>File permissions (also called chmod values) control who can read, write, and execute files on the server. Correctly configured permissions are essential for both security and functionality of your website.</p>
<h3>Permission Basics</h3>
<p>Each file and directory has three permission categories:</p>
<ul>
<li><strong>Owner</strong> - The user who owns the file (typically your hosting account).</li>
<li><strong>Group</strong> - Users in the same group as the file owner.</li>
<li><strong>Others</strong> - Everyone else (public/world).</li>
</ul>
<p>Each category can have three types of permissions:</p>
<ul>
<li><strong>Read (r = 4)</strong> - Permission to view the file contents or list a directory.</li>
<li><strong>Write (w = 2)</strong> - Permission to modify the file or add/remove files in a directory.</li>
<li><strong>Execute (x = 1)</strong> - Permission to run the file as a script or access a directory.</li>
</ul>
<h3>Common Permission Values</h3>
<ul>
<li><code>644</code> - Owner can read/write; group and others can read only. <strong>Standard for most files.</strong></li>
<li><code>755</code> - Owner can read/write/execute; group and others can read/execute. <strong>Standard for directories and scripts.</strong></li>
<li><code>600</code> - Owner can read/write only. No access for group or others. <strong>Use for sensitive configuration files.</strong></li>
<li><code>750</code> - Owner full access; group can read/execute; others no access.</li>
<li><code>777</code> - Full access for everyone. <strong>Avoid this setting as it is a security risk.</strong></li>
</ul>
<div class="alert alert-warning">Never set files or directories to <code>777</code> permissions. This allows anyone on the server to read, modify, and execute your files, creating a serious security vulnerability.</div>
<h3>Changing Permissions in File Manager</h3>
<ol>
<li>Open File Manager and navigate to the file or directory.</li>
<li>Select the file by clicking its checkbox.</li>
<li>Click <strong>Chmod</strong> (or <strong>Permissions</strong>) in the toolbar.</li>
<li>Enter the numeric permission value (e.g., <code>644</code>) or check/uncheck the permission boxes.</li>
<li>Click <strong>Set Permission</strong> or <strong>Save</strong>.</li>
</ol>
<h3>Changing Permissions via SSH</h3>
<p>If you have SSH access, use the <code>chmod</code> command:</p>
<pre><code>chmod 644 filename.php
chmod 755 directoryname
chmod -R 644 public_html/*.html</code></pre>
<div class="alert alert-info">The <code>-R</code> flag applies permissions recursively to all files within a directory. Use it carefully to avoid setting incorrect permissions on subdirectories.</div>
Need More Help?
Can't find what you're looking for? Our support team is ready to help.
Contact Support