Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using git bash on my windows computer. I am trying to set up an SSH tunnel so I can access databases within MySQL Query Browser. The following works:

> ssh root@staging

This uses my public key and gives me access over SSH successfully, but when I try this:

> ssh -L 3307:127.0.0.1:3306 \ root@staging

I get this error:

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

I am not sure how to troubleshoot this problem? I have tried replacing my hostname "staging" to the actual IP address, but no luck there as well. I have also tried the server IP address in place of 127.0.0.1.

Here is a snippet of sshd_config, which seems most important:

#AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

Thanks in advance.

share|improve this question
up vote 2 down vote accepted

when you connect using

ssh -L 3307:127.0.0.1:3306 \ root@staging

the '\' escapes the following space. therefore ssh is trying to connect with a username of ' root' not 'root'.

try without the \ and if it still fails add -vvv into the command line which provides some debugging output then update you're question with it so we can have a look.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .