PHP ssh2://


简介

libssh2 库使用安全加密传输访问远程机器上的资源。它们包括shell、远程执行、隧道、文件传输 SCP。PHP为这些资源提供了包装器。它们分别是ssh2.shell://、ssh2.exec://、ssh2.tunnel://、ssh2.sftp://ssh2.scp://

请注意,这些包装器默认情况下未启用。必须安装来自 PECL 的 SSH2 扩展。

用法

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.*// 上下文选项

会话预连接的 ssh2 资源将被重用
sftp预分配的 sftp 资源将被重用
方法密钥交换、主机密钥、密码、压缩和 MAC 方法,以使用回调
用户名用作连接的用户名
密码与密码身份验证一起使用的密码
pubkey_file用于身份验证的公開密钥檔案的名稱
privkey_file用于身份验证的私有密钥檔案的名稱
env要设置的环境变量的关联数组
终端分配 pty 时请求的终端仿真类型
term_width分配 pty 时请求的终端宽度
term_height分配 pty 时请求的终端高度
term_units与 term_width 和 term_height 一起使用的单位

更新于: 2020-09-22

221 次浏览量

开启您的 职业生涯

完成课程并获得认证

开始学习
广告
© . All rights reserved.