I am trying to connect to remote MySQL server, which runs on CentOS 6.6 cPanel server.

I am creating tunnel this way:

ssh -L 3306:xxx.xxx.xxx.xxx:3306 user@xxx.xxx.xxx.xxx -p PPPPP

Where xxx.xxx.xxx.xxx is remote server IP address, 3306 ic configured MySQL port, and user is my user name on remote machine, and xxx.xxx.xxx.xxx is IP address of machine which runs MySQL server respectively and PPPPP is non-default SSH port.

I have created id_rsa file with -r-------- permissions, and copied private key generated in cPanel into that file.

As the public/private key pair is created with passphrasse, when trying to connect, shell asks me for passphrase, and output with error:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

What am I doing wrong? My local machine is Debian 8.1 OS.

  • You possibly also need to add the remote host to .ssh/known_hosts – DopeGhoti Nov 30 '15 at 21:06
  • Put the public key in the remote user's ~/.ssh/authorized_keys file. – D_Bye Nov 30 '15 at 22:34
  • Post verbose log from ssh -vvv PPPPP. It should give you some clue. Also check the server log for authentication errors. – Jakuje Nov 30 '15 at 22:40

first of all: can you ssh to remote.host ?

if you can, then do:

local$ ssh -L 13306:localhost:3306 user@remote.host

put htop to keep-alive connection

remote.host$ htop

on another console:

local$ mysql -P 13306 -h localhost -u root -p
  • why not using -N? – Rui F Ribeiro Dec 1 '15 at 4:13
  • don't know, -L works for me! I prefare unix-karate: it is better to know few usefull commands, that really works, than many commands, that I can't apply in real world :) – shcherbak Dec 1 '15 at 7:51
  • -N does not need to keep a login session open. I would use autossh anyway. However I could swear it is not what the OP is asking. He seems to be having some problem in the protocol negotiation part. – Rui F Ribeiro Dec 1 '15 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.