private function connect($host, $target, $pwd = NULL)
{
$this->name = $host;
$this->log->verbose("Connecting to {$host} on port {$target['ssh_port']}");
if (!($conn = ssh2_connect($host, $target['ssh_port'], NULL, array('disconnect', array($this, 'disconnect'))))) {
$this->log->error("Unable to connect");
}
$this->log->verbose("Authenticating as {$target['deploy_user']} using {$target['public_key_file']}");
if (!ssh2_auth_pubkey_file($conn, $target['deploy_user'], $target['public_key_file'], $target['private_key_file'], $pwd)) {
$this->log->error("Unable to authenticate");
}
$this->log->ssh[$host] = $this;
return $conn;
}