Magento 1.9.2.3, after uploading images from backend, permission is set to 640 instead 644

Magento 1.9.2.3, after uploading images from backend, permission is set to 640 instead 644

July 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 1.9.2.3, after uploading images from backend, permission is set to 640 instead 644

Resolving Image Upload Permissions in Magento 1.9.2.3

If you’re facing issues with image upload permissions in your Magento 1.9.2.3 installation, where files are uploaded with permission 640 instead of the expected 644, this guide will walk you through a practical solution.

Understanding the Problem

Magento uses the umask value when creating new files during the upload process. The default umask in many Linux distributions is set to 022, which translates to permission 644 after creation. However, if your server setup has a different default umask or your PHP configuration overrides it, you might encounter this discrepancy.

Solving the Permissions Issue

To ensure that Magento uploads files with the correct permissions (644), we can adjust the umask value in the PHP configuration. Here’s how to do it:

  1. Locate your PHP configuration file: Depending on your server setup, you may find this file at /etc/php.ini, /etc/apache2/php.ini, or at an alternative location specified by the php.ini directive in your server configuration.

  2. Add the following line under the [PHP] section:

    umask = 002
    
  3. Save and close the file.

  4. Reload PHP to apply the changes:

    • For Apache: Run /etc/init.d/apache2 reload or systemctl restart apache2 if you’re using systemd.
    • For Nginx with PHP-FPM: Restart your FPM pool (sudo service php7.x-fpm restart).

Verifying the Changes

After making these changes, any new images uploaded through the Magento backend should now have permission 644. You can verify this by:

  1. Uploading an image via the Media gallery in the admin panel.
  2. Navigating to the upload directory using FTP or SSH (usually pub/media/catalog/product).
  3. Checking the permissions of your newly uploaded file.

Best Practices for File Permissions

While adjusting the umask is a quick fix, it’s important to maintain proper security around your Magento installation:

  • Always use secure file and folder permissions: Directories should typically be 755, while files should usually be 644.
  • Ensure that only trusted users have write access to essential directories.
  • Regularly update your Magento version to patch any known security vulnerabilities.

Conclusion

Adjusting the umask value in the PHP configuration is a straightforward way to ensure that Magento uploads images with the correct permissions. By following these steps, you’ll maintain a clean and secure file structure within your Magento store.

Remember, it’s crucial to keep your Magento installation up-to-date for both security and performance reasons. For more tips on Magento maintenance and best practices, feel free to explore our Magento tutorials at Laravel Company.

Happy coding!

Magento 1 Security API Admin

Our network