Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent forwarding #61

Open
loranger opened this issue Apr 25, 2017 · 0 comments
Open

Agent forwarding #61

loranger opened this issue Apr 25, 2017 · 0 comments

Comments

@loranger
Copy link

Hello

Thank you for this awesome package which makes any ssh connection more simple with PHP !

Right now, I try to connect on a server in order to rsync a folder to another one.
I have to enable agent forwarding but I cannot figure out how.

Can you help, please ?

Here is the code I currently use

$configuration  = new Ssh\Configuration($server);
$authentication = new Ssh\Authentication\Agent($current_user);
$session        = new Ssh\Session($configuration, $authentication);
$exec           = $session->getExec();
echo $exec->run("env | grep SSH_AUTH_SOCK");

Here is the result I would expect:

SSH_AUTH_SOCK=/tmp/ssh-Y8Boe6GL3q/agent.48545

And here is the Exception I get

PHP Fatal error:  Uncaught RuntimeException in /Users/loranger/Developer/myproject/vendor/herzult/php-ssh/src/Ssh/Exec.php:29
Stack trace:
#0 /Users/loranger/Developer/myproject/sync.php(41): Ssh\Exec->run('env | grep SSH_...')
#1 {main}
  thrown in /Users/loranger/Developer/myproject/vendor/herzult/php-ssh/src/Ssh/Exec.php on line 29

Fatal error: Uncaught RuntimeException in /Users/loranger/Developer/myproject/vendor/herzult/php-ssh/src/Ssh/Exec.php:29
Stack trace:
#0 /Users/loranger/Developer/myproject/sync.php(41): Ssh\Exec->run('env | grep SSH_...')
#1 {main}
  thrown in /Users/loranger/Developer/myproject/vendor/herzult/php-ssh/src/Ssh/Exec.php on line 29

What did I miss ? How can I do ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant