Class Client
SSH-Client
Bei der Authentifizierung mit einem Schlüssel, darf dieser nicht mit einem Passwort versehen sein, da sonst der Bug 58573 zum tragen kommt.
- Alvine\Core\Alvine
- Alvine\Infrastructure\Linux\SSH\Client implements Alvine\Infrastructure\Linux\System\Execute
Direct known subclasses
Alvine\Infrastructure\Linux\SSH\SFTP\Client
Namespace: Alvine\Infrastructure\Linux\SSH
Package: Alvine\Infrastructure\Linux
Category: Alvine
License: Alvine Nutzungslizenz
Author: schukai GmbH info@schukai.de
Version: $Revision:$
Since: 20141228
Link: Das Passwort kann mittels des folgenden Befehls entfernt werden. <code> openssl rsa -in id_rsa -out id_rsaNOPASSWORD </code> <code> // Der öffentliche Schlüssel ist der Schlüssel, der in der Datei authorized_keys auf dem Server gespeichert wurde $publicKey = 'ssh-dss AAAAB3NzaC1kc3MAAAEBAKafd9vAVnOv8WopVM...5vIL9mcSg== Schlüssel'; // Der private Schlüssel muss im openSSH Format vorliegen. $privateKey = '-----BEGIN DSA PRIVATE KEY----- MIIDPgIBAAKCAQEApp9328BWc6/xailUxmwwO3GQuqvZpI/7S/RB9zd9IK8kxY6w 7xktlT3dkn8nVH6+PXdGEEphd7//ZQ7 ... -----END DSA PRIVATE KEY-----'; // Das Passwort des Schlüssels $secret= 'geheim'; $credential = new \Alvine\Security\Authentication\Credential\PublicKey($publicKey, $privateKey, $secret); $port = 22; $config = new \Alvine\Infrastructure\Linux\SSH\Configuration(); // Neue Verbindung ausführen $connection = new \Alvine\Infrastructure\Linux\SSH\Client($host, $user, $credential, $port, $config); // Befehl ausführen $result = $connection->execute('ls -lah'); echo $result; // Daten übertragen $connection->send('hello world', '/tmp/hallo.txt'); // Daten empfangen echo $connection->receive('/tmp/hallo.txt'); // Verbindung trennen $connection->disconnect(); </code>
Link: alvine.io
Located at ssh/Client.class.php
Package: Alvine\Infrastructure\Linux
Category: Alvine
License: Alvine Nutzungslizenz
Author: schukai GmbH info@schukai.de
Version: $Revision:$
Since: 20141228
Link: Das Passwort kann mittels des folgenden Befehls entfernt werden. <code> openssl rsa -in id_rsa -out id_rsaNOPASSWORD </code> <code> // Der öffentliche Schlüssel ist der Schlüssel, der in der Datei authorized_keys auf dem Server gespeichert wurde $publicKey = 'ssh-dss AAAAB3NzaC1kc3MAAAEBAKafd9vAVnOv8WopVM...5vIL9mcSg== Schlüssel'; // Der private Schlüssel muss im openSSH Format vorliegen. $privateKey = '-----BEGIN DSA PRIVATE KEY----- MIIDPgIBAAKCAQEApp9328BWc6/xailUxmwwO3GQuqvZpI/7S/RB9zd9IK8kxY6w 7xktlT3dkn8nVH6+PXdGEEphd7//ZQ7 ... -----END DSA PRIVATE KEY-----'; // Das Passwort des Schlüssels $secret= 'geheim'; $credential = new \Alvine\Security\Authentication\Credential\PublicKey($publicKey, $privateKey, $secret); $port = 22; $config = new \Alvine\Infrastructure\Linux\SSH\Configuration(); // Neue Verbindung ausführen $connection = new \Alvine\Infrastructure\Linux\SSH\Client($host, $user, $credential, $port, $config); // Befehl ausführen $result = $connection->execute('ls -lah'); echo $result; // Daten übertragen $connection->send('hello world', '/tmp/hallo.txt'); // Daten empfangen echo $connection->receive('/tmp/hallo.txt'); // Verbindung trennen $connection->disconnect(); </code>
Link: alvine.io
Located at ssh/Client.class.php
public
|
#
__construct( string $host, Alvine\Security\Authentication\User $user, Alvine\Security\Authentication\Credential $credential, integer $port = 22,
Neue Verbindung |
public
|
|
protected
|
|
public
string
|
|
public
Alvine\Infrastructure\Linux\Process\Result
|
|
protected
string
|
|
public
|
|
public
|
#
sendFile( Alvine\IO\File\File $localFile, string $remoteFile, integer $mode = 0660 )
Lokale Datei übertragen |
public
|
|
public
|
|
public
string
|
protected
|
$config
Konfiguration |
|
protected
resource
|
$session
SSH-Session |
|
protected
string
|
$host
Server |
|
protected
integer
|
$port
Port |
|
protected
Alvine\Security\Authentication\User
|
$user
Benutzer |
|
protected
Alvine\Security\Authentication\Credential
|
$credential
Zugangsdaten |
|
protected
string
|
$fingerprint
Fingerprint |