The File Manager in cPanel is a powerful tool that allows you to manage your website files directly from your browser without using FTP or SSH. This guide covers advanced file operations, permission management, and security best practices.


Why Use File Manager?

  • Immediate Access: No need for external FTP clients.
  • Granular Control: Edit, upload, compress, and extract files.
  • Security: Manage permissions and restrict access to sensitive directories.

Step 1: Accessing File Manager

  1. Log in to your cPanel account.
  2. Navigate to Files → File Manager.
  3. Select the directory you want to manage (e.g., public_html for your main site).

Tip: Always work within public_html unless you need to modify configuration files outside the web root.


Step 2: Uploading Files

  • Click Upload in the top menu.
  • Drag and drop files or select them manually.
  • For large files, consider using FTP or SSH for better performance.

Advanced Tip:
If uploading scripts, verify file integrity using checksums (e.g., md5 or sha256) before deployment.


Step 3: Managing File Permissions

Permissions control who can read, write, or execute files. Incorrect settings can lead to security vulnerabilities.

Recommended Permissions

  • Files: 644 (Owner read/write, Group read, Public read)
  • Directories: 755 (Owner read/write/execute, Group read/execute, Public read/execute)

Changing Permissions

  1. Select the file or folder.
  2. Click Permissions or Change Permissions.
  3. Adjust using checkboxes or numeric values.

Warning:
Avoid 777 permissions (full access) as they expose your site to attacks.


Step 4: Advanced File Operations

  • Compress/Extract: Use built-in tools to zip files for faster transfers.
  • Edit Files: Use the Code Editor for syntax highlighting.
  • Search: Quickly locate files using the search bar.

Step 5: Security Best Practices

  • Restrict access to sensitive files using .htaccess:
     
     
     
    <FilesMatch "\.(env|config|php)$">
    Order allow,deny
    Deny from all
    </FilesMatch>
     
  • Regularly scan for malware using cPanel’s Virus Scanner.
  • Enable Hotlink Protection to prevent bandwidth theft

Troubleshooting

  • Upload Errors: Check PHP limits in MultiPHP INI Editor (e.g., upload_max_filesize).
  • Permission Denied: Ensure correct ownership; contact your host if needed.
  • Corrupted Files: Re-upload via FTP or restore from backup.
這篇文章有幫助嗎? 31 用戶發現這個有用 (122 投票)