Professional Documents
Culture Documents
Protocolos y Envolturas - Ssh2 en PHP
Protocolos y Envolturas - Ssh2 en PHP
http://php.net/manual/es/wrappers.ssh2.php
Downloads
Documentation
Get Involved
Help
Search
Getting Started
Introduction
A simple tutorial
Language Reference
Basic syntax
Types
Variables
Constants
Expressions
Operators
Control Structures
Functions
Classes and Objects
Namespaces
Errors
Exceptions
Generators
References Explained
Predefined Variables
Predefined Exceptions
Predefined Interfaces and Classes
Context options and parameters
Supported Protocols and Wrappers
Security
Introduction
General considerations
Installed as CGI binary
Installed as an Apache module
Session Security
Filesystem Security
Database Security
Error Reporting
Using Register Globals
User Submitted Data
Magic Quotes
Hiding PHP
Keeping Current
Features
1 de 6
28/01/17 00:45
http://php.net/manual/es/wrappers.ssh2.php
28/01/17 00:45
http://php.net/manual/es/wrappers.ssh2.php
gn
Next man page
G
Scroll to bottom
gg
Scroll to top
gh
Goto homepage
gs
Goto search
(current page)
/
Focus search box
rar://
phar://
Manual de PHP
Referencia del lenguaje
Protocolos y Envolturas soportados
Change language: Spanish
Edit Report a Bug
ssh2://
ssh2:// Secure Shell 2
Descripcin
ssh2.shell:// ssh2.exec:// ssh2.tunnel:// ssh2.sftp:// ssh2.scp:// PHP 4.3.0 y
superior (PECL)
Nota: Esta envoltura no est habilitada por omisin
Para poder usarse la envoltura ssh2.*:// debe instalarase la
extensin SSH2 disponible en PECL.
Adems de permitir hacer un login tradicional en la URI, la envoltura ssh2
tambin puede reutilizar las conexiones ya abiertas, proporcionando el
recurso de conexin en el apartado host de la URL.
Uso
ssh2.shell://usuario:contrasea@ejemplo.com:22/xterm
ssh2.exec://usuario:contrasea@ejemplo.com:22/usr/local/bin/comando
ssh2.tunnel://usuario:contrasea@ejemplo.com:22/192.168.0.1:14
ssh2.sftp://usuario:contrasea@ejemplo.com:22/ruta/a/fichero
3 de 6
28/01/17 00:45
http://php.net/manual/es/wrappers.ssh2.php
Opciones
Resumen de la Envoltura
ssh2.shell ssh2.exec ssh2.tunnel ssh2.sftp ssh2.scp
Atributo
Restringido por
S
allow_url_fopen
Permite Lecturas S
Permite
S
Escrituras
Permite Aadir
contenidos
Permite Lecturas
y Escrituras
Simultneas
Permite usar la
funcin stat()
Permite usar la
funcin unlink()
Permite usar la
funcin rename()
Permite usar la
funcin mkdir()
Permite usar la
funcin rmdir()
No
No
No
No
No
S (cuando
est
soportado
por el
servidor)
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Opciones de contexto
Nombre
session
sftp
methods
Uso
Valor por
omisin
callbacks
username
4 de 6
28/01/17 00:45
Nombre
http://php.net/manual/es/wrappers.ssh2.php
Valor por
omisin
Uso
SSH2_TERM_UNIT_CHARS
Ejemplos
Ejemplo #1 Abriendo un flujo a partir de una conexin activa
<?php
$session=ssh2_connect('example.com',22);
ssh2_auth_pubkey_file($session,'username','/home/username/.ssh/id_rsa.pub',
'/home/username/.ssh/id_rsa','secret');
$stream=fopen("ssh2.tunnel://$session/remote.example.com:1234",'r');
?>
28/01/17 00:45
http://php.net/manual/es/wrappers.ssh2.php
Be aware that opendir is currently broken on sftp root directories, but you can work
around it by appending a dot. See https://bugs.php.net/bug.php?id=64169 and
http://stackoverflow.com/a/16238476/69173.
up
down
1
exptom
3 years ago
The "password" context option can also be used to provide the passphrase for the
keyfile supplied by "privkey_file" and "pubkey_file".
Note this bug: https://bugs.php.net/bug.php?id=58573
Encrypted keys may not work unless you build libssh2 against openssl. (It only worked
for me on Debian Wheezy once I recompiled the library).
add a note
6 de 6
28/01/17 00:45