Skip to main content
11 events
when toggle format what by license comment
Jul 17, 2023 at 13:50 comment added Ghedeon Worked for, just needs some explanation. 1. port 22: Connection refused mean you need to enable Remote Login on your mac 2. Since the question is about local ports, use localhost instead of [email protected]
May 12, 2021 at 9:46 vote accept waitinforatrain
Apr 18, 2018 at 11:35 comment added user143943 @AlexanderTaylor -N does not mean there is no SSH connection. It simply means do not execute a remote command (see the man page). The <user>@<host> argument is necessary, because this does open an SSH connection to <host> (which for OP's case would be localhost), and forwards the desired port through that SSH tunnel. It is one solution for OP's problem, but not the simplest. To forward to localhost without using ssh, you can use socat or netcat as in StephaneChazelas and not-a-user 's answers
Dec 10, 2017 at 7:42 comment added Alexander Taylor I also get "connection refused". And I still don't understand why the [email protected] argument is needed when there is no SSH connection involved (according to -N). Should just forward packets.
Oct 27, 2017 at 13:03 comment added RidingTheRails If you want the port to be available from boot then see "autossh" in a systemd service using the above method - everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh
S Jun 13, 2017 at 13:23 history suggested Marián Černý CC BY-SA 3.0
formatting
Jun 13, 2017 at 13:06 review Suggested edits
S Jun 13, 2017 at 13:23
Feb 1, 2017 at 23:45 comment added Piotr Dobrogost @Hi-Angel [email protected] is just an example and you should not take it literally. You have to replace this with a name of computer you want to connect to and your username on this computer. This information is needed to establish ssh connection. Only after ssh connection is established ports can be forwarded through this connection.
Dec 1, 2016 at 13:43 comment added Hi-Angel What does the [email protected] do? It's definitely unneeded for port forwarding, however ssh mandates having this argument, more over, it tries to connect there. And upon setting this pesky option to hostname it outputs …port 22: Connection refused (no, I didn't use the 22 port). Unless I'm missing something, the command plainly doesn't work.
Apr 1, 2011 at 20:54 vote accept waitinforatrain
May 12, 2021 at 9:46
Apr 1, 2011 at 5:55 history answered penguin359 CC BY-SA 2.5