I followed the Digital Ocean tutorial for configuring secure updates for Wordpress using SSH keys and I am still being prompted for the FTP information when I try to install at new theme.
In the wp-config.php
file I added:
define('FS_METHOD', 'direct');
define('FTP_PUBKEY','/home/wp-user/.ssh/wp_rsa.pub');
define('FTP_PRIKEY','/home/wp-user/.ssh/wp_rsa');
define('FTP_USER','wp-user');
define('FTP_PASS','wp-pass');
define('FTP_HOST','127.0.0.1:22');
Where wp-user
and wp-pass
have been replaced by the appropriate user name and password. The FS_METHOD
line wasn’t in the tutorial, but something I saw suggested for related problems, e.g. here and here.
The permissions on the files are:
-rw-r--r-- 1 wp-user wp-user 755 Jul 16 21:03 authorized_keys
-rw-r----- 1 wp-user www-data 3326 Jul 16 20:57 wp_rsa
-rw-r----- 1 wp-user wp-user 738 Jul 16 21:00 wp_rsa.pub
The permissions on the ~/.ssh
, var/www
, :
drwx------ 2 wp-user wp-user 4096 Jul 16 21:03 .ssh
...
drwxrwxr-x 3 wp-user www-data 4096 Jul 13 13:51 www
I also prepended the RSA information in the authorized_keys
file with from="127.0.0.1"
and restarted apache with sudo service apache2 restart
more times than I care to admit.
Is there anything else I should be doing?
Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
In your question, you state:
By using ssh keys, there should be no password. Leave the password field blank (as it is in the tutorial you referenced).
Also, the tutorial instructs you to create and prepare a user called “wp-user”. If you were following that tutorial, that user should not be changed either, unless you did the same things to a different username.
{Edit}… Additonally…
FS_METHOD
should not be changed to “direct” as this instructs the updater to use direct filesystem commands rather than the ssh method you spent all that time in the tutorial preparing. If you wish to explicitly setFS_METHOD
, the value should be “ssh2”.