I got some issue using phpseclib,is like my second post, and I've figured it out partially but i can't get it working properly...
Anyway here is the issue: I've installed phpseclib using composer, and I'm using this test script in order to connect to my VPS hosted by amazon, that is giving me some troubles So what I understood is that I need to use the .pem key file in order to authenticate. Easy right?
That's the script:
<?php
include 'vendor/autoload.php';
$loader = new \Composer\Autoload\ClassLoader();
$loader->addPsr4('phpseclib\\', __DIR__ . 'vendor/phpseclib/phpseclib');
$loader->register();
use phpseclib\Crypt\RSA;
use phpseclib\Net\SSH2;
//$key = new Crypt_RSA();
$key = new RSA();
$ret = $key->loadKey(file_get_contents('Key_1.pem'));
if(!$ret){
echo "loadKey failed
";
exit;
}
// Domain can be an IP too
$ssh = new SSH2('ip.ip.ip.ip');
if (!$ssh->login('username', $key)) {
print_r($ssh->errors);
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
So here is some issues that I'm getting:
1- Crypt_RSA isn't working, Class not found (RSA class doesn't give me any errors) 2- Using RSA I'm getting this error
SSH_MSG_USERAUTH_FAILURE: publickey ) Login Failed
Maybe I'm doing something wrong with the path for the include?
phpseclib is located in:
vendor/phpseclib/phpseclib/phpseclib
Then I've the others folder...
I don't know! Please someone help me out!