Turns out that the SSH2 transport definately does not work on chroot'd SSH configurations at present.
This is because it relies on the ability to run shell commands, however that's not possible in a chrooted/sftp-only environment - This service allows sftp connections only.
.
The following methods require shell access at present:
- pwd() - Needed to locate directory
- chdir() - Not used by the SSH transport (but used by FTP systems)
- chgrp() - Not used
- chmod() - Used, but it's okay if it fails, especially on a SSH connection (It's far more expected the files will be created with the correct permissions IMHO)
- chown() - Not used
Based on that, it looks like we can fix pwd()
to use ssh2_sftp_realpath( $this->sftp_link, '.' );
instead of shell_exec( 'pwd' )
, which should fix SSH2 w/ chrooted environments.
This should avoid the need to make the FTP_*
constants work for SSH2.