Skip to content

Agent forwarding #61

@loranger

Description

@loranger

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions