I have only just downloaded Magento starting at Version 1.2.1.2 - Looks nice. But I immediately ran into the problem that Magento Connect would not work.
It would keep returning errors about file permissions.
ie
Error: Please check for sufficient write file permissions
Your Magento folder does not have sufficient write permissions, which this web based downloader requires.
If you wish to proceed downloading Magento packages online, please set all Magento folders to have writable permission for the web server user (example: apache) and press the “Refresh” button to try again.
After looking around on here, I pieced together that you needed to change the file permissions to get this to work. But that this had to be done via SSH, and not FTP.
I discovered this for myself. Because I changed all the file permissions to 777 on ftp, but still got the error.
Anyhow, I have just figured out how to do this with SSH, and its really quite easy. However, for the technically challenged I have set out a step by step process of EXACTLY what you need to do. As frankly, this would have saved me a lot of time figuring it all out if it had been here to begin with, and someone else will undoubtedly benefit from the knowledge.
I am definitely not claiming to be an expert on this stuff, so don’t ask me questions. This is simply what I did. Its not rocket science though, and I do think that these things are often made to seem harder then they really are (hence the post)
Here you go.
Exactly how to SSH into a server and change the file permissions to get Magento Connect working:
How To Login Using SSH and Change File Permissions
2/ Open the PuTTY client (usually putty.exe). You will now see the “PuTTY Configuration” window.
3/ On the left side, you will see a tree structure called “Category:”. There are four categories: Session, Terminal, Window, and Connection. Expand the “Connection” category and select “SSH”.
4/ On the right side, look in the middle:
for “Preferred SSH protocol version:”. Select version “2”.
5/ On the left side in the category tree structure, go back to “Session”.
6/ On the right side, look for the “Host Name (or IP Address)” input box at the top. Enter your server’s main IP address only.
eg 66.12.12.15 - Whatever. Ask your host if you don’t know what it is. Odds are that it will appear somewhere on you welcome email from them, or else if you have cpanel then you will be able to see it on their.
7/ Click ‘Open’ and a window appears.
8/ Click on the little empty green box with your left mouse. It will then fill with green and you will be able to type (This applies all the time)
9/ Login as: (Put in the username you would login as on your server)
10/ Then root@66.12.12.15 Password: (ie the 66.12.12.15 will be whatever IP address you put in) - Put in the password for your server here
11/ Ok. You are now logged into the ‘root’ of your server. That means the very bottom layer. So you will want to change directories in order to run some commands to change file permissions:
So…
12/ In my server I had to type cd /home/mysite/public_html
Note - My magento install was setup in the root of the domain.
If I had set it up in a folder called ‘magento’ (as lots of folk seem to here) then I would have instead typed:
cd /home/mysite/public_html/magento
Tip: If you haven’t got a scoobies what to put here then you can do two things to find out.
- Type the command ‘ls’ at the prompt will list the folders. So you can see what is available.
- Try ftping into your site. If you look at the box at the top it shows you what you need to type ie just go into the folder whose permissions you want to change in ftp and copy the url bar
13/ Now comes the ‘magic’ that will get Magento Connect working
Copy the following line: (Code courtesy of a Crucial post)
find . -type d -exec chmod 777 {} \;
--------------------------------------
Once putty (ssh) is in the right folder above (ie wherever you installed it - only you know this - and incidentally, you do this at your own risk. I am simply letting you know what worked for me. Changing directories to 777 actually strikes me as a really dumb thing to do, but it appears at the time of writing to be the only way to get Magento Connect to work (Magento Dudes - you really need to change this)
My prompt line looked like this to give you some idea:
2/ Open the PuTTY client (usually putty.exe). You will now see the “PuTTY Configuration” window.
3/ On the left side, you will see a tree structure called “Category:”. There are four categories: Session, Terminal, Window, and Connection. Expand the “Connection” category and select “SSH”.
4/ On the right side, look in the middle:
for “Preferred SSH protocol version:”. Select version “2”.
5/ On the left side in the category tree structure, go back to “Session”.
6/ On the right side, look for the “Host Name (or IP Address)” input box at the top. Enter your server’s main IP address only.
eg 66.12.12.15 - Whatever. Ask your host if you don’t know what it is. Odds are that it will appear somewhere on you welcome email from them, or else if you have cpanel then you will be able to see it on their.
7/ Click ‘Open’ and a window appears.
You can actually just enter the hostname and click the Open button, as SSH is the default protocol.
8/ Click on the little empty green box with your left mouse. It will then fill with green and you will be able to type (This applies all the time)
There’s no need to click on the green box, just make sure the SSH window is active (not minimized) and you can start typing.
----------
While this was a great guide for beginners on using SSH, my question is:
If you have access to SSH, it does not make sense to set the permissions like this just to use the web-based Magento Connect. You’re in SSH already, so use that instead.
On your server (or anyone who gets this error) you have PHP running as an Apache module (DSO). So processes spawned from the browser are ran by user nobody. So any files that Magento Connect downloads or updates will also be owned by user nobody.
This is why you have to set directories to 777, because this user does not have permission to mess with files with default 644 permissions (or directories with default 775 permissions). They aren’t owned by nobody, so they have to have full read/write permissions (bad).
When you’re in SSH, you’re logged in as the appropriate user for your site, so this user doesn’t need special permissions to do things.
Just use SSH to install extensions or upgrade Magento:
Now you don’t have to worry about setting your file permissions insecurely, and can take advantage of SSH to quickly get things done.
Also, for users who DO have root access to the server, avoid using this user to do things. You mentioned you have cPanel installed, so SSH in as this user, not root, otherwise, any process YOU initiate as root will then make any files/directories that are created now owned by user root, and not the user for that account.
If you just need to reset your file and folder permissions, assuming you have a standard host configuration that allows for permissions of 755:folder / 644:file, then:
1) Download Magento Clean Up Tool
2) Unzip magento-cleanup.php to the root of your magento installation
3) Browse http://yourdomain.com/magento/magento-cleanup.php
Thank you skippybosco
Unfortunately doesn’t work on my site. I got
Warning: chmod() [function.chmod]: Operation not permitted in http://yourdomain.com/magento/magento-cleanup.php on line 9
I have to say, the “help” above did the same thing to my installation.
What the heck is gogin on here, why is this so difficult? jeez just want to connect to magento connect. this should be a top priority for varien to get right and support
In regards to what skippybosco said to use the clean up tool; if you use ssh to access, you can use the wget command to get the url in order for it to run if there is no web access permissions to use it through the browser.
I’m running into the issue where the menu links in the admin menu fail to work properly. Some of them work, but most of them do not.
I ran the magento-cleanup tool both in my browser and also in SSH. It cleaned everything up properly. I also then manually checked the chmod settings for various folders that the cleanup tool changed, all looks well.
However, the links in the menu still fail to work :(