File: ssh2_auth_key.phpt

package info (click to toggle)
php-ssh2 1.3.1%2B0.13-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 472 kB
  • sloc: ansic: 5,963; xml: 477; pascal: 38; makefile: 1
file content (24 lines) | stat: -rw-r--r-- 575 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
ssh2_auth_pubkey_file() - Tests authentication with a key
--SKIPIF--
<?php require('ssh2_skip.inc'); ?>
--FILE--
<?php require('ssh2_test.inc');

$ssh = ssh2_connect(TEST_SSH2_HOSTNAME, TEST_SSH2_PORT);

var_dump(ssh2_auth_pubkey_file($ssh, TEST_SSH2_USER, TEST_SSH2_PUB_KEY, TEST_SSH2_PRIV_KEY));

$cmd=ssh2_exec($ssh, 'echo "testing echo with key auth"' . PHP_EOL);

var_dump($cmd);

stream_set_blocking($cmd, true);
$response = stream_get_contents($cmd);
echo $response . PHP_EOL;

--EXPECTF--
bool(true)
resource(%d) of type (stream)
testing echo with key auth