WordPress keeps asking for connection information in localhost

I tried to find and answer but even though the problem is common I haven’t been able to fix it, WP keeps asking me for the FTP info on my local LAMP environment when trying to install, delete or update themes and plugins.

I have set my local www folder permissions like this:

Read More
drwxrwsr-x  3 root www-data 4096 Oct 28 07:43 www/

So the users in the www-data group have full access to the folder, I also ran chmod -R 775 on my site root folder to make sure the owner and group had full permissions as well.

I can upload files using the media upload just fine and I can delete them as well, I can also change the .htaccess file on the permalink menu so the permissions are at least partially working.

If I change the owner of the site folder to the www-data user recursively it works fine but since the files and their parent folders group is www-data and they have full group permissions I shouldn’t need to do this, is this correct?

Related posts

1 comment

  1. Parts of WordPress use (s)FTP to transfer files. Updates, for example, use (s)FTP. Media uploads do not, at least not unless something has changed in 3.7. If you are connecting to an (s)FTP server you have to provide the credentials that that server needs. Your file permissions won’t come into play until after that connection is made.

    There are constants that you can define that should make this easier to manage. From the Codex:

    define( 'FS_METHOD',       'ftpext' );
    define( 'FTP_BASE',        '/path/to/wordpress/' );
    define( 'FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/' );
    define( 'FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/' );
    define( 'FTP_PUBKEY',      '/home/username/.ssh/id_rsa.pub' );
    define( 'FTP_PRIKEY',      '/home/username/.ssh/id_rsa' );
    define( 'FTP_USER',        'username' );
    define( 'FTP_PASS',        'password' );
    define( 'FTP_HOST',        'ftp.example.org' );
    define( 'FTP_SSL',         false );
    

Comments are closed.