Can't login to server using ssh key
dheche opened this issue · 6 comments
Why i can't login to server using ssh key ? no problem when i try using user/password
This is my server list yaml
webapp.server:
host: x.x.x.x
user: myname
identity_file: ~
stage: development
deploy_path: /home/myname/playground
this is my recipe
<?php
require 'recipe/common.php';
task('deploy', [
'deploy:prepare'
]);
this is error msg when i run deploy
[RuntimeException]
Unable to login with the provided credentials.
Exception trace:
() at phar:///var/www/webloyer/vendor/bin/dep/src/Server/Remote/PhpSecLib.php:89
Deployer\Server\Remote\PhpSecLib->connect() at phar:///var/www/webloyer/vendor/bin/dep/recipe/common.php:71
{closure}() at n/a:n/a
call_user_func() at phar:///var/www/webloyer/vendor/bin/dep/src/Task/Task.php:73
Deployer\Task\Task->run() at phar:///var/www/webloyer/vendor/bin/dep/src/Executor/SeriesExecutor.php:39
Deployer\Executor\SeriesExecutor->run() at phar:///var/www/webloyer/vendor/bin/dep/src/Console/TaskCommand.php:82
Deployer\Console\TaskCommand->execute() at phar:///var/www/webloyer/vendor/bin/dep/vendor/symfony/console/Command/Command.php:259
Symfony\Component\Console\Command\Command->run() at phar:///var/www/webloyer/vendor/bin/dep/vendor/symfony/console/Application.php:878
Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/webloyer/vendor/bin/dep/vendor/symfony/console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///var/www/webloyer/vendor/bin/dep/vendor/symfony/console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///var/www/webloyer/vendor/bin/dep/src/Deployer.php:99
Deployer\Deployer->run() at phar:///var/www/webloyer/vendor/bin/dep/bin/dep:62
require() at /var/www/webloyer/vendor/bin/dep:4
deploy [-p|--parallel]
Hi,
There was the following description in the official documents:
If your keys were created with a password or if they are located outside of the
.ssh
directory, you can specify the location by providing the full path.
Please try the following:
webapp.server:
host: x.x.x.x
user: myname
identity_file:
public_key: /path/to/your/public_key
private_key: /path/to/your/private_key
password: yourpassword
stage: development
deploy_path: /home/myname/playground
Yes, i read the official documents already, that why i use ~
in identity_file because my key is located in ~/.ssh/id_rsa
I tested it using php artisan serve
, so, yes this instance is running with my regular user.
As you suggestion, i also try using fullpath to my public and private key. I also try to copy my keys to /var/www/webloyer and adjust public_key and private_key to this path. Still no luck.
FYI, i'm using passwordless key, so i try password: null
(no luck, same error), then i try strip password:
(only public_key and private_key). No luck either.
Hmmm, what about the following?
webapp.server:
host: x.x.x.x
user: myname
password: yourpassword
stage: development
deploy_path: /home/myname/playground
I would like to confirm just in case; are you running the following command as myuser
?
nohup php artisan queue:listen --timeout=0 &
By the way, do you happened the same problem when you run the dep
command directly from the command-line?
yes, same result when i try dep command directly from command line.
`[dheche@fountain dclely]$ /var/www/html/webloyer/vendor/bin/dep -vvv deploy
➤ Executing task deploy:prepare
↳ on [production]
[RuntimeException]
Unable to login with the provided credentials.
Exception trace:
() at phar:///var/www/html/webloyer/vendor/bin/dep/src/Server/Remote/PhpSecLib.php:99
Deployer\Server\Remote\PhpSecLib->connect() at phar:///var/www/html/webloyer/vendor/bin/dep/recipe/common.php:105
{closure}() at n/a:n/a
call_user_func() at phar:///var/www/html/webloyer/vendor/bin/dep/src/Task/Task.php:79
Deployer\Task\Task->run() at phar:///var/www/html/webloyer/vendor/bin/dep/src/Executor/SeriesExecutor.php:43
Deployer\Executor\SeriesExecutor->run() at phar:///var/www/html/webloyer/vendor/bin/dep/src/Console/TaskCommand.php:82
Deployer\Console\TaskCommand->execute() at phar:///var/www/html/webloyer/vendor/bin/dep/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at phar:///var/www/html/webloyer/vendor/bin/dep/vendor/symfony/console/Application.php:791
Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/html/webloyer/vendor/bin/dep/vendor/symfony/console/Application.php:186
Symfony\Component\Console\Application->doRun() at phar:///var/www/html/webloyer/vendor/bin/dep/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///var/www/html/webloyer/vendor/bin/dep/src/Deployer.php:101
Deployer\Deployer->run() at phar:///var/www/html/webloyer/vendor/bin/dep/bin/dep:63
require() at /var/www/html/webloyer/vendor/bin/dep:4
deploy [-p|--parallel]`
It looks like a issue of Deployer.
I am not knowledgeable about an implementation of Deployer.
Please try downloading a latest deployer.phar
file by executing the composer install
command.
If it still does not work, please ask about this issue in Deployer's issues page.
Thanks for your clarification. Temporary solution is add "->forwardAgent()" when using "->identityFile()". This issue is related to deployphp/deployer#653