Richard Zintage
Richard Zintage

Reputation: 1

ssh2_auth_pubkey_file fails with Segmentation fault (core dumped) on Ubuntu 24.04

Logged into Ubuntu 24.04 and did the following

apt-get update<br>
apt-get install php<br>
apt-get install php-ssh2<br>

Then created a file called test.php with the following code to an IP that has root access using keys

$connection = ssh2_connect('x.x.x.x', 22);<br>
ssh2_auth_pubkey_file($connection, 'root', '/root/.ssh/id_rsa.pub', '/root/.ssh/id_rsa');

This throws the following error message:

Segmentation fault (core dumped)

ssh to x.x.x.x on the command line works

Upvotes: 0

Views: 99

Answers (1)

C&#233;dric
C&#233;dric

Reputation: 1

I think the issue come from https://bugs.php.net/patch-display.php?bug=79702&patch=ssh2_fix_nullpointer_deref.patch&revision=1617965812

you can define the parameter "passphrase" with an empty string, like :

$connection = ssh2_connect('x.x.x.x', 22);
ssh2_auth_pubkey_file($connection, 'root', '/root/.ssh/id_rsa.pub', '/root/.ssh/id_rsa', '');

Upvotes: 0

Related Questions