0

I would like to tunnel a mysql database. So I thought I use a private key without a passphrase to make it reboot friendly. The problem is, openssh still asks me for a passphrase and if I leave it empty it denies the connection. Is there a way to disable the passphrase question and allow a connection without a password ?

/usr/bin/autossh -M 20009 -N -L 3307:127.0.0.1:3306 -p 22 -i /home/tunnel-vserver_main-mysql/keys/tunnel_mysql ssh-tunnel@IP

tunnel_mysql looks like this, is that wrong ?:

I deleted a bit and it is still a trash key.
PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20130902
Public-Lines: 4
AAAAB3NzaC1yc2EAAAABJQAAAIBSeG8XkgFsq3TK8MQm9+8Uk+waP0k/xfySbE2Q
ktBsaG/XQd6MskhPjPr*****j5p0VcfWfkpopVB/s
iA1WNJl4Tw/ELxRe6s8XJaz+G2L6K4nCZK/rTdAus4MuwAwWFUmteU7P/Okb6jQ3
SNWPVQ==
Private-Lines: 8
AAAAgDwuXuevu9mtjJQXemGgKwEtrEqBNXO5/X+bI9gzyIZ1uWW6cff3uDoM7mZQ
kznCzjZmvK2l7DhVlHeO2hUKXdldzAIIZmILiIuQb819Hupb4jxApk7zwQREYqW2
a8+pz5LdtGHt****AGaEB+cbCULCeHrzJPP9BY
sWigPwjI47vbAAAAQQCFLH7cXVEiNzmHZyX6XE2Gu++t4LvIVtegBb8koKOzOM9O
6EGDP7I+V4nQI+L6ykKIL6S4pNJp9UaHCKGLwOCPAAAAQHE50FWzp1uB9KJ4qYJe
NS4pLSC88KOYJyT6W66Z1nCLeAL9VG2v1vOZoDsuXDUroVj4uEjq0wmdmif2fOMH
HoM=
Private-MAC: ***
user2693017
  • 203
  • 3
  • 12
  • 1
    Are you sure the key is in the correct format? What do you see what you do a `head -3 /home/tunnel-vserver_main-mysql/keys/tunnel_mysql`? Does it say `-----BEGIN RSA PRIVATE KEY-----`, or something else? Do you see lines like `Proc-Type: 4,ENCRYPTED`, `DEK-Info: DES-EDE3-CBC`? – Zoredache Sep 02 '13 at 02:11
  • edited top post, too long for comment – user2693017 Sep 02 '13 at 02:29
  • 1
    Well there is your problem. You are trying to use a Putty key with OpenSSH. The formats are not compatible. Use the Putty Key gen tool's function that permits you to export an OpenSSH key. See: http://serverfault.com/a/182324/984 – Zoredache Sep 02 '13 at 03:13
  • found it thanks. If you create this as answer I mark it as done – user2693017 Sep 02 '13 at 03:37

2 Answers2

0

You can use normal ssh for that:

ssh -f ssh-tunnel@IP -L 3307:localhost:3306 -N

Just ensure that the key is in the .ssh/id_rsa for that account and that it is also in the .ssh/authorized_users file on the remote end.

Aaron Mason
  • 703
  • 6
  • 20
0

Perhaps Stunnel would be appropriate here?

https://www.stunnel.org/index.html

Paul
  • 1