I have set up ssh server on my Raspberry pi and forwarded 22 port on router to it. I can connect to it via local network just fine, my friend could also connect to it from his home. However, when I try

ssh pi@my.router.ip.address -v

where my.router.ip.address is external address of my router, I get

OpenSSH_6.7p1 Ubuntu-5ubuntu1.3, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to XX.XX.XX.XX [XX.XX.XX.XX] port 22.
debug1: Connection established.
debug1: identity file /home/julka/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/julka/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1.3

The last line hangs untill I Ctrl+C it, independently if I allow password authentication or not. My ~/.ssh. contents:

id_rsa  id_rsa.pub  known_hosts

and /etc/ssh/ssh_config (no user config)

Host *
ForwardX11Trusted yes
RSAAuthentication yes
PasswordAuthentication yes
IdentityFile ~/.ssh/id_rsa
HashKnownHosts yes

What of the most basic things am I missing that I cannot ssh into my Raspi?

I even tried creating julka account on my ssh server as per @darent suggestion.


Pi's /etc/ssh/sshd_config/ (commented lines skipped):

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server
  • For some reason, it's trying to authenticate with your user keys (julka, not pi) and I'm not sure, but that may be the problem. It looks in the server for such user and it doesn't exists. Try forcing the server to prompt you for a password with this: ssh -v -o PreferredAuthentications=password pi@my.router.ip.address And post the output here. – animaletdesequia Sep 5 '15 at 17:51
  • Does the ~/.ssh/id_rsa.pub of the client is the relevant public key for the Pi server's private key ~/id/rsa ? – heemayl Sep 5 '15 at 19:16
  • I copied my public key alright, if that's what you re asking. I can connect without typing password through local network. – julka Sep 5 '15 at 19:46
  • Can you please post more lines of the debug log? It says the connection is established but the really interesting things happen after the point where you've truncated the output. Also what is the ip address of 'my.router'; is it the internal or the external address? – wie5Ooma Sep 5 '15 at 21:20
  • @wie5Ooma That's all there is to it, external address. – julka Sep 6 '15 at 10:27

Connecting to your own external IP from inside your LAN may have some strange effects. You should try to connect from an other external Internet access (e.g. mobile or through VPN).

This is the answer from my comment above.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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