Resolving drupal ftp error when installing modules

When installing a new drupal site under Linux, you may get this annoying error when trying to install a module:

So what? install an FTP server? NO.

This is clearly a permission error, however, setting folder permissions to 777 (or 666 😉 ) just won’t do it.

The thing is, the user log into Apache needs to be the owner of this folder.

So, to remedy this, use:
chown -R  www-data /var/www/dp7/sites/default

assuming you installed under /var/www/ which is the default in ubuntu.