[wp-trac] [WordPress Trac] #35946: ssh2/sftp doesn't work in chrooted environments

WordPress Trac noreply at wordpress.org
Thu Feb 25 09:19:32 UTC 2016


#35946: ssh2/sftp doesn't work in chrooted environments
----------------------------+-----------------------------
 Reporter:  aberbenni       |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Filesystem API  |    Version:  4.4.2
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 This is a follow-up to #32345 and #33919.

 I'm using same (ssh2 chrooted environments) configuration on a new test
 server with php7 fpm and SSH2 support enabled, extension version 0.12+dev,
 libssh2 version      1.4.3, banner SSH-2.0-libssh2_1.4.3

 Tested on 4.4.2 here is extra debug from WP_Filesystem_Base::$verbose when
 attempting an update to a plugin:


 {{{
 Looking for /var/www/www.mydomain.com/website/wp-content in /
 The update process is starting. This process may take a while on some
 hosts, so please be patient.

 Looking for /var/www/www.mydomain.com/website/wp-content in /
 Updating plugin Akismet (1/1)
 An error occurred while updating Akismet: Unable to locate WordPress
 Content directory (wp-content).
 Looking for /var/www/www.mydomain.com/website in /
 All updates have been completed.
 }}}


 I decided to install Wp FS Tester and run it but, it crashes with log:


 {{{
 PHP Fatal error:  Uncaught Error: Call to undefined function split() in
 /var/www/www.mydomain.com/website/wp-content/plugins/wp-filesystem-
 tester.php:42
                               Stack trace:
                               /var/www/www.mydomain.com/website/wp-
 content/plugins/wp-filesystem-tester.php(113): wpfs_get_base_dir('/',
 true)
                               /var/www/www.mydomain.com/website/wp-
 includes/plugin.php(525): wsts_page('')
                               /var/www/www.mydomain.com/website/wp-
 admin/admin.php(236): do_action('toplevel_page_w...')
                               {main}
                               thrown in /var/www/www.mydomain.com/website
 /wp-content/plugins/wp-filesystem-tester.php on line 42
 }}}


 I decided to fix lines 42 and 40 with this code:


 {{{
 if( strpos($abspath, $base) > 0)
                 $arrPath = explode('/',substr($abspath,strpos($abspath,
 $base)));
         else
                 $arrPath = explode('/',$abspath);
 }}}


 Then run fixed Wp FS Tester:


 {{{
 Connection Method       ssh2
 ABSPATH /var/www/www.mydomain.com/website/
 PLUGINDIR       wp-content/plugins
 FS Errors       None
 FS CWD  /
 FS WordPress Locator    Ricerca di /var/www/www.mydomain.com/website in /
 FS WordPress Location
 FS0 WordPress Locator (Old code)        Modificando in /
 FS0 WordPress Location (Old code)
 Tests Stopped; Error: WordPress could not be located    Files in folder
 }}}

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


More information about the wp-trac mailing list