SSH accepts connections from within local network, but closes connection immediately when port forwarded through router
So I have a min 2011 iMac running Yosemite, I have remote login turned on under sharing in system preferences and if I try to SSH to my machine from another machine (or my phone) on the same wifi network, everything works fine. However, if I try to do the same thing from the internet (connecting to username@public_IP etc. and forwarding port 22 through my router to the iMac in question) the iMac closes the connection immediately. I've used Packet Peeper to see that the forwarded port is working correctly and the iMac is receiving the SSH packets.
In console I see :
Feb 7 20:15:52 My-iMac com.apple.xpc.launchd[1] (com.openssh.sshd.53F53F04-74AB-40F0-9A86-462EA1B1F814): Service instances do not support events yet.
Feb 7 20:15:52 My-iMac.local sshd[529]: Could not write ident string to UNKNOWN
Feb 7 20:15:52 My-iMac com.apple.xpc.launchd[1] (com.openssh.sshd.53F53F04-74AB-40F0-9A86-462EA1B1F814[529]): Service exited with abnormal code: 255
I don't know what else to try. Any advice?
Thanks,
Matt