Jump to content
Калькуляторы

ssh авторизация по ключу в php

Из sh работает, пробую в php из system, shell_exec... пишет ошибку, пробую вот так:

 

shell_exec("ssh -i /usr/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 700 user@host 'ls' 2>&1");

 

Вывод:

Could not create directory '/nonexistent/.ssh'.

Warning: Permanently added '[somehost.com]:700' (RSA) to the list of known hosts.

Permission denied, please try again.

Permission denied, please try again.

Permission denied (publickey,password).

Share this post


Link to post
Share on other sites

скорее всего, неверные пермишены на файл ключа.

 

ну а вообще есть ssh модуль для php, лучше его использовать.

 

libssh2-php в debian/ubuntu

 

или поставить http://www.php.net/manual/en/ssh2.installation.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this