Fixed SSH auth

feature/node-rewrite
Sven Slootweg 13 years ago
parent 8a8724c266
commit 80829e5b80

@ -72,11 +72,11 @@ class SshConnector extends CPHPBaseClass
if(empty($this->passphrase)) if(empty($this->passphrase))
{ {
$result = ssh2_auth_pubkey_file($this->user, $this->pubkey, $this->key); $result = ssh2_auth_pubkey_file($this->connection, $this->user, $this->pubkey, $this->key);
} }
else else
{ {
$result = ssh2_auth_pubkey_file($this->user, $this->pubkey, $this->key, $this->passphrase); $result = ssh2_auth_pubkey_file($this->connection, $this->user, $this->pubkey, $this->key, $this->passphrase);
} }
if($result === true) if($result === true)
@ -100,7 +100,7 @@ class SshConnector extends CPHPBaseClass
private function DoCommand($command) private function DoCommand($command)
{ {
$stream = ssh2_exec($this->connection, $command); $stream = ssh2_exec($this->connection, $command);
echo($stream); var_dump($stream);
} }
} }

@ -13,6 +13,7 @@
$_CPHP = true; $_CPHP = true;
require("cphp/base.php"); require("cphp/base.php");
require("include.exceptions.php");
require("classes/class.controller.php"); require("classes/class.controller.php");
require("classes/class.container.php"); require("classes/class.container.php");
require("classes/class.node.php"); require("classes/class.node.php");

@ -6,4 +6,8 @@ $ssh = new SshConnector();
$ssh->host = "cvm-vz.cryto.net"; $ssh->host = "cvm-vz.cryto.net";
$ssh->key = "/etc/cvm/key"; $ssh->key = "/etc/cvm/key";
$ssh->pubkey = "/etc/cvm/key.pub"; $ssh->pubkey = "/etc/cvm/key.pub";
var_dump($ssh);
$ssh->RunCommand("df -h");
?> ?>

Loading…
Cancel
Save