PHP ssh2://

PHPServer Side ProgrammingProgramming

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

sessionPreconnected ssh2 resource to be reused
sftpPreallocated sftp resource to be reused
methodsKey exchange, hostkey, cipher, compression, and MAC methods to use callbacks
usernameUsername to connect as
passwordPassword to use with password authentication
pubkey_fileName of public key file to use for authentication
privkey_fileName of private key file to use for authentication
envAssociate array of environment variables to set
termTerminal emulation type to request when allocating a pty
term_widthWidth of terminal requested when allocating a pty
term_heightHeight of terminal requested when allocating a pty
term_unitsUnits to use with term_width and term_height
raja
Published on 22-Sep-2020 10:50:15
Advertisements