I have problem with ssh2_Auth_Pubkey_File. I have one server for
connecting to others. On all of theese is FreeBSD installed, but
different versions.

I am using dsa keys for connecting. From command line works everything
fine (with using the same key files). But from php I have problem - a
few servers with new version of FreeBSD dont accept connection.

On machine where is php installed I have this message in php errorlog:

[Tue Jun 12 12:15:37 2012] [error] [client ::1] PHP Warning:
ssh2_auth_pubkey_file(): Authentication failed for useruser using public
key: Username/PublicKey combination invalid in /usr/local/www/pokus.php
on line 119

and in auth.log on remote machine I have:

Jun 12 12:15:37 remote10 sshd[14012]: Did not receive identification
string from 92.62.224.xx

I thing, that problem is not in script - I am able to connect to some
machines. But where could be a problem, I dont know.

Here are methods, which I have to tried:

        #private $_METHODS              = Array('hostkey' => 'ssh-dss');
        private $_METHODS               = Array('kex' =>
'diffie-hellman-group1-sha1','hostkey' => 'ssh-dss','client_to_server'
=> Array('crypt' => '3des-cbc','mac' => 'hmac-md5','comp' =>
'none'),'server_to_client' => Array('crypt' => '3des-cbc','mac' =>
'hmac-md5','comp' => 'none'));

        private function Set_Connection()
                $this->_connection = ssh2_Connect($this->_device_hostname,
$this->_device_port, $this->_METHODS);
                        $this->_connection = NULL;
                        return false;
                if(!ssh2_Auth_Pubkey_File($this->_connection, $this->_USER,
                        $this->_connection = NULL;
                        return false;
                return true;

Thank you for any suggestion.

Reply via email to