Wordpress asking for FTP Credentials

February 21, 2014 37k views
https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04, Okay, I used this for installing my wordpress. When I am trying to install a new theme, it is asking for FTP credentials, but I don't know what to insert.
1 comment
  • I am using a similar site called http://www.vps.net/ I purchased their Ubuntu 16.04 VPS 12 dollars a month for 1 GB of RAM and 25 GB of storage. I used shell access and a tutorial on how to install the LAMP stack, and install WordPress using the chown and chmod commands. I assigned the user wordpressuer with sudo priveleges, and I created an SQl database with the same user using PHP My Admin. All was going well and smoothly, up until I got to the point where I needed to update WordPress and or install additional plugins. I tried using WinSCP to set every single file with 7777 permissions, but it still keeps asking me for FTP credentials, and I haven't found any tutorials on how to set up an FTP server on Ubuntu 16.04 that could solve this problem until I can figure out why I keep getting this error. My WordPress and other stuff is in /var/www/html. I have it set up so that my WordPress is installed in a directory called /blog, and my podcast generator in /podcasts.
    Also, there is a popular CMS called Podcast Generator which I mentioned above. Before installing, it runs some scripts to determine if it has the needed writing and execution permissions in the following directories. If there are problems, it will tell you so you can change the writing permissions to 7777. I think WordPress needs to have something similar so it can be made easier to troubleshoot errors like these.

11 Answers
Does running the following commands fix it?
sudo chown username:www-data /var/www -R 

sudo chmod g+w /var/www -R

After you upload your files, you’ll want to make sure ownership permissions are set to Apache so that Wordrpess can update and/or install plugins without requiring FTP credentials. You can set permissions via SSH.

Single site hosting:

chown -R apache:apache /var/www/html

Multi site hosting:

chown -R apache:apache /var/www/

You may need to do this whenever uploading folders.

Source: http://www.visiblexposure.com/seomiami/configure-server-permissions-wordpress-not-require-ftp-plugin-installsupdates/

WordPress usually asks for your FTP credentials when it can't access the files directly on the root of your webserver. This is usually caused by PHP running as the apache user (mod_php or CGI) rather than the user that owns your WordPress files.

More info on the WordPress Forum:
http://wordpress.org/support/topic/plugin-install-asks-for-ftp-details
Thank you Kamal! This works for me!
Kamal this is not working for me

ryanginx that worked for me too. thx!!

Please, I run `sudo chown username:www-data /var/www -R
sudo chmod g+w /var/www -R
but don't work to me.```

How should I replace the commands??? Sorry, I'm beginner...

I insert

define('FS_METHOD', 'direct');

And too not works...

This is user's permission problem that will be solved by method given below that worked for me.

step-1 : First open wp-config.php file of your wordpress installation folder.
step-2: Copy below code and paste it at the end of the wp-config.php file.

define('FS_METHOD','direct');

step-3: Now open your droplet access console and enter root as username and its password.
step-4: Copy below code and paste it into access console where you have to specify your plugin directory path and then hit enter.

chmod 777 /yourwebsitename/public/wp-content/plugins/

Note: Replace your website name in the place of yourwebsitename.
Thank you.

define('FS_METHOD', 'direct');
This worked for me too.

sudo chown username:www-data /var/www -R

Have another answer? Share your knowledge.