[wp-trac] [WordPress Trac] #29635: 4.0 - Installation step 0 fails, if FS_METHOD is set to ssh2 in wp-config.php

WordPress Trac noreply at wordpress.org
Thu Sep 11 22:44:11 UTC 2014


#29635: 4.0 - Installation step 0 fails, if FS_METHOD is set to ssh2 in wp-
config.php
--------------------------+-----------------------------
 Reporter:  scibuff       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Steps to reproduce:

 1.) create a new WP installation (with a brand new database) under
 /var/www/mysite
 2.) create a new user for ftp, e.g.

     sudo adduser wpuser
     sudo chown -R wpuser:www-data /var/www/mysite
     sudo su - wpuser
     ssh-keygen -t rsa -b 4096 -C wpuser@<myhost>
     sudo chown wpuser:www-data /home/wpuser/wp_rsa*
     sudo chmod 0640 /home/wpuser/wp_rsa*
     sudo mkdir /home/wpuser/.ssh
     sudo chown wpuser:wpuser /home/wpuser/.ssh/
     sudo chmod 0700 /home/wpuser/.ssh/
     sudo cp /home/wpuser/wp_rsa.pub /home/wpuser/.ssh/authorized_keys
     sudo chown wpuser:wpuser /home/wpuser/.ssh/authorized_keys
     sudo chmod 0644 /home/wpuser/.ssh/authorized_keys
     #
     #you may need to install some packages
     #sudo apt-get update
     #sudo apt-get install -y php5-dev libssh2-1-dev libssh2-php
     #
     sudo service apache2 restart

 3.) set the following values in wp-config.php

     define('FS_METHOD', 'ssh2');
     define('FTP_PUBKEY','/home/wpuser/wp_rsa.pub');
     define('FTP_PRIKEY','/home/wpuser/wp_rsa');
     define('FTP_USER','wpuser');
     define('FTP_PASS','');
     define('FTP_HOST','127.0.0.1:22');

 Now navigating to install.php will fail step 0 at
 `wp_can_install_language_pack()`

 WordPress database error Table '<db-name>.wp_options' doesn't exist for
 query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`)
 VALUES ('ftp_credentials',
 'a:3:{s:8:\\"hostname\\";s:12:\\"127.0.0.1:22\\";s:8:\\"username\\";s:0:\\"\\";s:15:\\"connection_type\\";s:3:\\"ssh\\";}',
 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`),
 `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)
 made by wp_can_install_language_pack, WP_Upgrader->fs_connect,
 Automatic_Upgrader_Skin->request_filesystem_credentials,
 WP_Upgrader_Skin->request_filesystem_credentials,
 request_filesystem_credentials, update_option, add_option

 Commenting our the FS_METHOD and the FTP_* values fixes the problem. Once
 the installation is through, one can uncomment them and everything seems
 to work just fine.

 This doesn't seem to affect anything before 4.0 where, I believe, the
 steps in install.php were quite different, i.e. there was no
 `wp_can_install_language_pack()` obviously


 p.s. I hope I got all of the sftp user setup right above in step 2, but
 hopefully anyone looking into this will have the knowledge to set that up
 correctly. If not, this should help
 `https://www.digitalocean.com/community/tutorials/how-to-configure-secure-
 updates-and-installations-in-wordpress-on-ubuntu`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29635>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list