Drupal 7 Update Manager Unable to Connect via FTP

On some out-of-the-box configs Drupal 7 is unable to use the Update Manager to install modules and themes. There are many causes for this error, but a common on that has little coverage on the web is having mis-matched file/directory owners on the Linux file system.

Before you go crazy troubleshooting your FTP installation, port numbers and the like, attempt an FTP transfer using the same username, passowrd, port, etc through a standard FTP client. If it works, then try the following:

Connect to the Linux box through the shell. cd to the web root where your Drupal folder is located. Run the following command

chown -R www-data {your_directory_name_here}

...and then try the Update Manager again. If it works, the problem was that some other user (like "root" perhaps) owned the entire Drupal directory. On an Apache server running Drupal, www-data should "own" these files to alleviate this and other problems, such as the Update Manager successfully downloading the TAR file but failing to install the new theme/module.

This also helps when you feel you are "over-permitting" your files by setting 777 permissions to get things to work, when you really feel you shouldn't be. The problem there is that the web user "www-data" is not the "owner" so the first permission bit (in cases like 755, etc) is failing to let that user write/etc.

I hope this helps, it's a simple problem that seems to be falling through the cracks on Drupal dot org.

As a side note, I also tried setting the "temp" directory in Drupal to a subdir within /tmp but I don't know if that's required - next time around I'll try without that step and post the results!