Wordpress Update Asking for FTP login details

WordPress Update Asking for FTP login details

It happens to me numerous times, so I think I’ll need to write it down here so I can remember steps to stop wordpress from asking FTP login details again in the future and I hope it helps you as well if you have the same issue as me.

It’s not just happened in VPS server, but sometimes in a shared hosting as well. But mostly happened when I have my own VPS (Virtual Private Server) or Dedicated Server where all things need to setup on my own, meanwhile the shared hosting will have every thing ready for users.

Why WordPress Update Asking for FTP details?

Wordpress Update Asking for FTP login details
WordPress Update Asking for FTP login details

image credit: threeroutes.com

It happens due to permission access on your account/server.

Permissions will be different from host to host, but commonly, all files should be owned by your user (cpanel username/ftp) account on your web server, and should be writable by that account. On shared hosts, files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody user).

Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress. So here is the root of this problem, wordpress will need a write-access in its directory every time you clicked “update plugins” or upgrade wordpress core.
When it fails to meet the requirement, it will prompt you to enter FTP details manually.

More information about Changing file permissions: http://codex.wordpress.org/Changing_File_Permissions

How to fix wordpress ftp settings?

1. Change file permission

Login to your server and change file permissions.
For example, I have my wordpress installed on /var/www/

Run this command:
root@SenseiPhone:~# cd /var (means: change directory to /var)
root@SenseiPhone:/var# chown www-data:www-data www -R (means change ownership to user & group www-data for www directory –recursively)

Change /var and www according to your webserver installation settings.

I don’t usually need the second and third option. But in case you need any other way, see the 2nd and 3rd option.

2. Add FTP details to wp-config.php
If you have trouble or accessing your server through ssh is not possible for some reasons, you may add FTP credentials information to wp-config.php file

You’ll want to specify the details for your connection and then add them in the wp-config.php file. You can add these lines in the end of the content of wp-config.php

define(‘FTP_USER’, ‘username’);
define(‘FTP_PASS’, ‘password’);
define(‘FTP_HOST’, ‘ftp.example.org’);

define(‘FTP_SSL’, true); (add this as well if you want to use use secure connection)

3. Change permission to 777

The other option is changing the wordpress installation or plugins directory to 777, which makes all files and folders readable, writable, and executable by all users, groups, and processes.

The worst case about changing to 777 is that if a bad guy (read: cracker) or entity is able to upload a devious file or modify a current file to execute code, they will have complete control over your blog, including having your database information and password.

So the third options isn’t really recommended and it’s not necessary as well. Because usually you can just fix wordpress from asking ftp with the first step I mentioned above.

I hope it resolves your wordpress from asking ftp details when upgrade/update plugins.

Published by

Febryan Paudi

Febryan Paudi is Apple enthusiast. Falling in love with Apple-tech since 2008, loves Blogging since high-school. Google+

Leave a Reply