MacOS – Port Forwarding an SSH Connection on macOS

macosNetworksshterminal

I have been trying to use SSH over the internet to connect to a few different computer on my network. Unfortunately, it only seems to work on the computer that is set to the forwarded port of 22 (ssh port). Here is what I have done:

Router:
Port forward 70 -> computer IP address

macOS Terminal:

ssh -L 22(ssh port) : my_external_ip : 70(forwarded port) username@my_external_ip

It connects and then asks me for the password for the account "username".
Even though I type in the correct password, it gives me "Permission denied (publicly, password)

I have been trying this all day and cannot figure it out. I can access my router non-locally and change the computer I am trying to access to forward to port 22, but I would really like a better solution.

I am not very familiar with bash commands (I think these are bash?) and am at a loss. Fortunately I have been able to connect to my storage server via SAMBA, but I would really like to be able to ssh into each computer independently.

Best Answer

Create multiple forwarding rules in the router, one for each machine behind it that you want to SSH into. Use different high ports as the input for each.