[wp-trac] [WordPress Trac] #32345: ssh2/sftp doesn't work in chrooted environments, FTP_BASE, FTP_CONTENT_DIR, FTP_PLUGIN_DIR not available
WordPress Trac
noreply at wordpress.org
Fri Jun 12 09:51:42 UTC 2015
#32345: ssh2/sftp doesn't work in chrooted environments, FTP_BASE, FTP_CONTENT_DIR,
FTP_PLUGIN_DIR not available
----------------------------+-----------------------------
Reporter: aberbenni | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.3
Component: Filesystem API | Version: 2.7
Severity: normal | Resolution:
Keywords: | Focuses: administration
----------------------------+-----------------------------
Comment (by bondnono):
Replying to [comment:10 dd32]:
> @bondnono - Can you please try the above patch and see if that fixes the
problems you're seeing?
First of all, thanks a lot for the time you are spending trying to help me
with this issue.
Unfortunately, your solution does not fix the problem, I still get the
"Unable to locate WordPress Content directory (wp-content)." error.
{{{
$this->run_command('pwd'); // returns false
ssh2_sftp_realpath( $this->sftp_link, '.' ); // returns '/'
}}}
But it doesn't really surprises me as the whole concept of jailing a user
is to make it unaware of the environment it is in. So I don't know how PHP
could manage to get that information. Anyway, from the above tests, the
ssh2_sftp_realpath does seem to be a better solution than the pwd (at
least in my env).
A solution that does work is the one proposed in the initial post
(changing the ftp detection in the class-wp-filesystem-base). The main
reason for that is that the ABSPATH constant is "wrong" if we are working
in a chrooted env, that's why I don't think that there is a simple logic
that would make the chrooted and non-chrooted work. Instead, we require
the chrooted users to use additional constants to specify the BASE,
CONTENT_DIR and PLUGIN_DIR of the user's env and the FTP constant do
exactly that.
Thanks again.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32345#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list