PHP ssh2://



Introduction

The libssh2 library provides access to resources on a remote machine using a secure cryptographic transport. These are shell, remote exec, tunneling, file transfer and SCP. PHP has wrappers for these resources. They are ssh2.shell://, ssh2.exec://, ssh2.tunnel://, ssh2.sftp://, and ssh2.scp:// respectively

Note that these wrappers are not enabled by default. SSH2 extension available from PECL must be installed.

Usage

ssh2.shell://user:pass@example.com:22/xterm
ssh2.exec://user:pass@example.com:22/usr/local/bin/somecmd
ssh2.tunnel://user:pass@example.com:22/192.168.0.1:14
ssh2.sftp://user:pass@example.com:22/path/to/filename

ssh2.*// context options

session Preconnected ssh2 resource to be reused
sftp Preallocated sftp resource to be reused
methods Key exchange, hostkey, cipher, compression, and MAC methods to use callbacks
username Username to connect as
password Password to use with password authentication
pubkey_file Name of public key file to use for authentication
privkey_file Name of private key file to use for authentication
env Associate array of environment variables to set
term Terminal emulation type to request when allocating a pty
term_width Width of terminal requested when allocating a pty
term_height Height of terminal requested when allocating a pty
term_units Units to use with term_width and term_height
Updated on: 2020-09-22T10:50:15+05:30

342 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements