This module is a PHP wrapper for the libssh2 extension with support for interactive sessions. With interactive session support you can mimic a user terminal allowing you access to things such as sudo which might not typically be available to remote sessions. Unlike most libssh2 libraries, you do not need a public key file to authenticate using keys pairs.
This project requires PHP-SSH2, which can be installed with pecl
:
yum install libssh2-devel
# apt-get install libssh2-1-dev
yes '' | pecl install -f ssh2
echo "extension=ssh2.so" > /etc/php.d/ssh2.ini
# echo "extension=ssh2.so" > /etc/php5/mods-available/ssh2.ini
# ln -s /etc/php5/mods-available/ssh2.ini /etc/php5/apache2/conf.d/20-ssh2.ini
# ln -s /etc/php5/mods-available/ssh2.ini /etc/php5/cli/conf.d/20-ssh2.ini
- Added timeout & line-ending normalisation to smart commands
- Added the ability to detect remote shell type
- Smart commands now work on C-shell variants
- Added pause timeouts to all other shell read functions
- Added the ability to normalise line-endings in shell output
- Deprecated version 1.3.x
- Fixed logic of the ssh2_tunnel() function
- Added support to tunnel connections
- Added ability to connect using just a private PEM key
- Added SCP support
This wrapper is subject to the same bugs that exist in the ssh2 extension, notable of those are the encrypted private key files running in Ubuntu/Debian:
- https://bugs.php.net/bug.php?id=58573
- See Encrypted Private Keys for workaround
- Password and key-pair authentication
- Optional fingerprint checking
- Command execution
- Interactive shell (mimic user)
- SCP transfers
- Public key generation (connect using just a private key)
- Tunnels (remote connections)
- Agent and host authentication
- SFTP transfers