note 123878 added to function.ssh2-sftp
| From: | Youz@php.net | Date: | Thu, 23 May 2019 07:36:44 +0000 |
| Subject: | note 123878 added to function.ssh2-sftp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211111@lists.php.net to get a copy of this message | ||
Adding a function to previous class to connect with key instead of user/password
<?php
public function loginWithKey($username, $publicKey, $privateKey, $passphrase = null)
{
if (!@ssh2_auth_pubkey_file($this->connection, $username, $publicKey, $privateKey,
$passphrase)) {
throw new Exception("Could not authenticate with given keys or passphrase");
}
$this->sftp = @ssh2_sftp($this->connection);
if (!$this->sftp) {
throw new Exception("Could not initialize SFTP subsystem.");
}
}
?>
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 92.154.25.152)
----
Manual Page -- http://php.net/manual/en/function.ssh2-sftp.php
Edit -- https://master.php.net/note/edit/123878
Del: integrated -- https://master.php.net/note/delete/123878/integrated
Del: useless -- https://master.php.net/note/delete/123878/useless
Del: bad code -- https://master.php.net/note/delete/123878/bad+code
Del: spam -- https://master.php.net/note/delete/123878/spam
Del: non-english -- https://master.php.net/note/delete/123878/non-english
Del: in docs -- https://master.php.net/note/delete/123878/in+docs
Del: other reasons-- https://master.php.net/note/delete/123878
Reject -- https://master.php.net/note/reject/123878
Search -- https://master.php.net/manage/user-notes.php