[wp-trac] [WordPress Trac] #33919: ssh2/sftp doesn't work in chrooted environments, FTP_BASE, FTP_CONTENT_DIR, FTP_PLUGIN_DIR not available
WordPress Trac
noreply at wordpress.org
Sat Sep 19 03:38:06 UTC 2015
#33919: ssh2/sftp doesn't work in chrooted environments, FTP_BASE, FTP_CONTENT_DIR,
FTP_PLUGIN_DIR not available
----------------------------+------------------
Reporter: talatorre | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4
Component: Filesystem API | Version: 4.3
Severity: major | Resolution:
Keywords: | Focuses:
----------------------------+------------------
Changes (by dd32):
* milestone: Awaiting Review => 4.4
Comment:
@talatorre gratefully allowed me access to a test account on the server in
question, I was able to find one major bug that was preventing it working:
- The PHP SSH2 extension was failing to be able to access, or list, the
contents of the `/` directory.
This affected two main things:
- `$wp_filesystem->is_dir( '/' )` would return false
- `$wp_filesystem->dirlist( '/' )` would return false
I'm not sure why, but this appears to be something to do with the way the
SSH2 wrappers interact with the server. Take the following two examples:
- `dir(ssh2.sftp://Resource id #9/)` - Listing the `/` directory, fails
- `dir(ssh2.sftp://Resource id #9/home/account/)` - Listing my accounts
home directory succeeds
- `dir(ssh2.sftp://Resource id #9/./)` - Listing the `/./` directory,
which is really `/` succeeds (you could also use `/../`)
This has lead me to this PHP bug: https://bugs.php.net/bug.php?id=64169
which actually offers up the same workaround as I've already come up with.
Attached is [attachment:33919.diff] which implements that workaround and
centralises the code. Also attached a full copy of [attachment:class-wp-
filesystem-ssh2.php `class-wp-filesystem-ssh2.php`] which can be dropped
in to test with - @aberbenni can you try that out?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33919#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list