public function SSH::connect

public SSH::connect()

Connects to the server.

Overrides FileTransfer::connect

File

core/lib/Drupal/Core/FileTransfer/SSH.php, line 24

Class

SSH
The SSH connection class for the update module.

Namespace

Drupal\Core\FileTransfer

Code

public function connect() {
  $this->connection = @ssh2_connect($this->hostname, $this->port);
  if (!$this->connection) {
    throw new FileTransferException('SSH Connection failed to @host:@port', NULL, array('@host' => $this->hostname, '@port' => $this->port));
  }
  if (!@ssh2_auth_password($this->connection, $this->username, $this->password)) {
    throw new FileTransferException('The supplied username/password combination was not accepted.');
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!FileTransfer!SSH.php/function/SSH::connect/8.1.x