Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SSH.php

function SSH::connect

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', 0, [
            '@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.');
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal