Setting Default Wordpress FTP, SSH & SFTP Details

February 10, 2012

Sometimes hosts are really un-helpful and don't set up your Wordpress ftp details for you, or maybe you set your Wordpress install up yourself and Wordpress is asking you for FTP details.

Either way, what you'll quite quickly find, or have already found (hence your now here reading this post) is that downloading plugins is slick when Wordpress just WORKS. When it asks you for FTP credentials everytime, well...that's just annoying.

So how can we stop this? Well it's pretty easy actually.

What you'll need

  • Access to editing your wp-config.php file
  • Your host's FTP or SFTP details

Get cracking

Open up your wp-config.php file, found in the root of your Wordpress install.

Add the following if you just want standard FTP connection.

define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/home/site-name/www/');
define('FTP_CONTENT_DIR', 'wp-content');
define('FTP_PLUGIN_DIR ', 'wp-content/plugins/');
define('FTP_USER', 'yourFTPUsername');
define('FTP_PASS', 'yourFTPpassword');
define('FTP_HOST', 'yourFTPhost');
define('FTP_SSL', false);

To connect with SFTP then all you'll need to do is add to the above, the following definitions and add your credentials paths.

define('FTP_PUBKEY', '/home/username/.ssh/');
define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');

Trust me when I say this, when Wordpres just WORKS. It is a great experience!

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.