FTP Username and password wrong while installing theme

I followed Failed to connect to FTP Server 127.0.0.1/:21

And was able to solve that problem. But now when I try to upload the theme then I get username and password failure.

Read More

I have added following lines in wp-config.php

define( 'FS_METHOD', 'ftpext' );
define( 'FTP_BASE', '/var/www/wordpress/' );
define( 'FTP_CONTENT_DIR', '/var/www/wordpress/wp-content/' );
define( 'FTP_PLUGIN_DIR ', '/var/www/wordpress/wp-content/plugins/' );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'localhost' );
define( 'FTP_SSL', false );

How I can resolve this problem?enter image description here

UPDATE:

I tried this link and removed all values for ftp which are in wp-config.php
But still same error.

Related posts

Leave a Reply

3 comments

  1. if you do not want to (or you cannot) change permissions on wp-content so your web server has write permissions, then add this to your wp-config.php file:

    define('FS_METHOD', 'direct');
    
  2. Back up the config file before making a change;

    sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.back
    

    and then edit vsftpd.conf (with vi or nano)

    nano /etc/vsftpd.conf
    

    Then make the following change

    pam_service_name=ftp
    

    Save your change and restart the ftp server (if you use nano hit CTRL+O & enter to save then CTRL+X to exit)

    sudo service vsftpd restart
    
  3. NO, this is only because of the owner/permission of your folder where wordpress files are present. Please check the folder permission, if that is 0755 then replace it with 0777 by using chmod 777 -R FOLDERNAME
    and try to upload, After this if will get again same issue change the folder owner by using chown www-data FOLDERNAME

    For example in your case the folder name is wordpress then use the following commands for changing permisssion/owner

    chown -R www-data:www-data /var/www
    find /var/www/ -type d -exec chmod 755 {} ;
    find /var/www/ -type f -exec chmod 644 {} ;
    

    I believe this will work for you.

    Also you can define FS_METHOD as direct in wp-config.php so you will not get FTP detials at the time of installation of Theme/Plugin.

    define('FS_METHOD', 'direct);
    

    Thanks