Overview
The Magento eCommerce shopping application contains a web based management interface that allows extensions to be downloaded and installed. However due to the way some shopping carts are implemented the permissions to save the downloaded extensions fails due to reported "Permission Errors". This error message usually appears on the Magento Connect main menu once you have logged in.
To solve this issue, the directory and file permissions in the ./app and ./download directories need to be configured correctly. If the directories and files are owned by the web server then this is usually not an issue, however many users use an FTP account to upload content to the web server and so the files and directories may be owned by a different user than the web server.
Introduction To Linux Permissions
Linux implements three permission models, "Owner", "Group" and "Other" and for each model it allows for Read, Write and Execute. The permissions are actually stored in "Octal" or base 8 notation so all permissions for the owner are 700, all permission for the group are 070 and all permissions to anyone else are 007 so when you put them together you get 777 as a permission setting. To enable the owner to have full permissions to a file but everyone else read only the permissions would be 744 or rwxr–r– for access to a directory the "X" bit needs to be set (bit 1) so the permissions on a directory would be 755 ("rwxr-xr-x").
Generally a file is set to 664 ("rw-rw–r–") that means the owner can read it and write to it, the members of the same group can read and write it but anyone else can only read it.
In most Magento installations the directories are setup with permissions of 755 and files with permissions 664 and the directories and files are owned by the web server software (typically the user "apache is assigned to the web server).
Web Server owned file and directories
If the files are owned by the web server then:
- Log into the web site using SSH and once at the shell level change to the root user.
- Navigate to where the Magento app has been installed, often it is /var/www/vhost/<domain name>/
- Review the permissions and ownership of the app and download directories. They should be owned by the web server and the permissions should be rwxr-xr-x or 755
- To change the directories of the app directory execute the following command:
find ./app -type d -exec chmod 755 {} ; -print
- To change the files of the app directory execute the following command:
find ./app -type f -exec chmod 664 {} ; -print
- To change the download directory permissions, run the commands again but substitute the words "download" and "app".
User owned file and directories
if the web server and the owner/group setting of the file are not the same then:
- Log into the web site using SSH and once at the shell level change to the root user.
- Navigate to where the Magento app has been installed, often it is /var/www/vhost/<domain name>/
- Review the permissions and ownership of the app and download directories. They should be owned by the web server and the permissions should be rwxrwxr-x.
- To change the directories of the app directory execute the following command:
find ./app -type d -exec chmod 777 {} ; -print
- To change the files of the app directory execute the following command:
find ./app -type f -exec chmod 666 {} ; -print
- To change the download directory permissions, run the commands again but substitute the words "download" and "app".
To verify the change, open the web store, log into the admin panel, then log into the Magento Connect web page, if there are still permission errors a red error message will appear on the top of the page.