84 votes

An SSH tunnel via multiple hops

OpenSSH v7.3 onward supports a -J switch and a ProxyJump option, which allow one or more comma-separated jump hosts, so, you can simply do this now: ssh -J jumpuser1@jumphost1,jumpuser2@jumphost2,...,...
nikolay's user avatar
  • 943
79 votes
Accepted

Why is a tunnel called a "tunnel"?

In the case of roads, a real world tunnel is a constructed passage that allows you to pass directly from A to B instead of taking a route that is longer and/or has more things to slow you down. ...
Mokubai's user avatar
  • 92.8k
37 votes

Why is a tunnel called a "tunnel"?

Why is a tunnel called a "tunnel"? The phrase was first used (as far as I can tell) in RFC 1075 Distance Vector Multicast Routing Protocol, where it is defined as follows: In addition, to ...
DavidPostill's user avatar
  • 157k
29 votes
Accepted

how to run a tunnel in the background as part of a shell script

The first command didn't have time to establish a tunnel when the second command was run, thus giving a "Connection refused". Just don't use & but use instead the option -f: -f Requests ...
A.B's user avatar
  • 5,936
28 votes

How to mount remote SSHFS via intermediate machine? Tunneling?

You can use option ssh_command of sshfs to do the trick: sshfs ma: /mnt -o ssh_command='ssh -t mb ssh' Unmount with the usual fusermount -u /mnt Sorry this is 7 years late...
Rodrigo Farias's user avatar
24 votes

SSH Reverse socks tunnel

local$ ssh -R 1080 remote remote$ curl --socks5 localhost https://example.com since OpenSSH 7.6 ssh(1): add support for reverse dynamic forwarding. In this mode, ssh will act as a SOCKS4/5 proxy ...
zmx's user avatar
  • 349
21 votes
Accepted

How to modify this code to be able to SSH into my server?

The script you found works by counting the number of sshd processes that belong to the user who tries to log in via SSH. If the number is greater than or equal to the limit (1 in your case) then the ...
Kamil Maciorowski's user avatar
20 votes

Why is a tunnel called a "tunnel"?

Because whatever you put in one end of the tunnel comes out the other end.
David Schwartz's user avatar
17 votes

An SSH tunnel via multiple hops

I did what I think you wanted to do with ssh -D 9999 -J host1 host2 I'm prompted for both passwords, then I can use localhost:9999 for a SOCKS proxy to host2. It's the nearest I can think of to the ...
Cheryl's user avatar
  • 179
17 votes

How can I set in the bitvise ssh client, the tunnel automatic connect if open windows or restart windows?

The Bitvise SSH Client user interface does not provide an option to start the profile automatically when Windows 10 starts up. Instead, you can create a shortcut to Bitvise with the -loginOnStartup ...
humbads's user avatar
  • 271
14 votes

An SSH tunnel via multiple hops

My answer is really the same as all the other answers here, but, I wanted to clarify the usefulness of ~/.ssh/config and ProxyJump. To illustrate this, suppose I needed to get to a destination in 3 ...
Stephen Quan's user avatar
12 votes

How to mount remote SSHFS via intermediate machine? Tunneling?

This is what works for me on HighSierra 10.13.6, SHFS version 2.5 (OSXFUSE SSHFS 2.5.0) OSXFUSE 3.10.4. FUSE library version: 2.9.7 Based on Rodrigo Farias's answer above + clemisch and Ohad Rubin ...
dcneuro's user avatar
  • 121
12 votes

OpenVPN: Only route a specific IP addresses through VPN?

In response to the comments asking for an easy linux / networkmanager friendly solution to customizing what gets routed over OpenVPN, here is a GUI friendly way to set it up. This answer is, as far as ...
DeveloperACE's user avatar
12 votes
Accepted

SSH Tunnel via native Windows bash: Address already in use

In case anyone else finds this, there is a work around... you just need to reformat the tunnel with a specific bind address like this: ssh -L 127.0.0.1:8022:173.22.0.1:22 [email protected] From ...
dnszero's user avatar
  • 236
12 votes

SSH parameterized config entries?

Credit to Kamil for bringing me to the idea with the Match in the first place, it looks like his answer is the working one if you do not have one of the latest openssh versions (which is probable not ...
gepa's user avatar
  • 1,081
11 votes

Bluetooth over IP?

I've beed on the same (or similar) thought recently. What I want to do is to use a home automation hub, which unfortunately cannot reach the whole house with single-location radio. My setup is as ...
Lukas's user avatar
  • 111
11 votes
Accepted

Tunneling git through ssh (to get past a firewall): port specification interperted as relative path?

Why does it not work http://localhost:3333/path/to/repo.git This fails because the URL's hostname is different (localhost vs server2), and as a result the server uses a different configuration. All ...
u1686_grawity's user avatar
11 votes
Accepted

SSH parameterized config entries?

The below solution was tested with ssh from OpenSSH, version 9.3 (but it should work with reasonably non-ancient older versions as well, I guess from 7.2 where bz#2471 was fixed). For 9.4 and later ...
Kamil Maciorowski's user avatar
10 votes

Forward SSH traffic through a middle machine

For interactive shell you can use this simple command: ssh -J <user>@<hostB> <user>@<hostC> The -J options is for jump.
ssasa's user avatar
  • 211
7 votes

SSH parameterized config entries?

While the OpenSSH "tags" feature mentioned by 'gepa' is probably the neatest option when available, it's still recent enough that your systems are likely to not have it yet, and in that case ...
u1686_grawity's user avatar
6 votes

SSH Tunnel for restricted user w/ PuTTY and no shell

Just saw that PuTTY has the following option and it may be what you are looking for : Connection->SSH->Don't start a shell or command If enabled, the connection is made, no more display on the ...
Roland STAUB's user avatar
6 votes
Accepted

Transparent tunnel between interfaces on remote hosts

I haven't tried this myself, but I know you can use gretap to tunnel layer 2 (ethernet) over layer 3 (ip). According e.g. to this blogentry, you set up one gretap interface at each end and bridge it ...
dirkt's user avatar
  • 16.9k
6 votes
Accepted

How can I quiet or suppress the "channel 3: open failed: connect failed: Connection refused" message when using an SSH tunnel?

Did you try the ssh -E option and redirect debug logs towards /dev/null ? ssh -E /dev/null <server> Extract from man ssh: -E log_file Append debug logs to log_file instead of ...
Gohu's user avatar
  • 989
6 votes
Accepted

Use SSH to Create an HTTP Proxy without browser

Duplicate of How to chain SOCKS proxies? To chain proxies: https://superuser.com/a/843766/19867 ssh -tt -v -L1234:localhost:12345 user@server1 ssh -t -D 12345 user@server2
glallen's user avatar
  • 2,204
6 votes

How do I utilize TunnelBroker's free /48 block of IPv6?

From what I understand, TunnelBroker is a service that acts as your ISP and allows you a public IPv6 address pointing directly to your machine even if it is behind a NAT. Well, yes. You can also call ...
u1686_grawity's user avatar
5 votes

Forward SSH traffic through a middle machine

Alternatively, since OpenSSH 7.3 introduces a ProxyJump directive: Host final ProxyJump intermediate In example: Host intermediate Hostname 10.0.0.42 User root Host final Hostname final....
Peque's user avatar
  • 1,041
5 votes
Accepted

Tunnel wireguard (or any UDP traffic) inside HTTPS

This seems to do exactly what I want, even though you need cntlm as an additional proxy if the proxy requires NTLM authentication.
Volker's user avatar
  • 348
5 votes
Accepted

Accessing localhost web server via reverse SSH tunnel and URL

-R 8080:localhost:80 is usually not enough. See man 1 ssh [emphasis mine]: -R [bind_address:]port:host:hostport […] Specifies that connections to the given TCP port or Unix socket on the remote (...
Kamil Maciorowski's user avatar
4 votes

How to only pass browser traffic to openvpn connection

I had specifically this problem and couldn't find an easy to use solution. Basically the approach is still to set up SOCKS server in the VPN server. I've made this Docker image to make it actually ...
kizzx2's user avatar
  • 977
4 votes

An SSH tunnel via multiple hops

Only this helped me on more than two hosts: ssh -L 6010:localhost:6010 user1@host1 \ -t ssh -L 6010:localhost:6010 user2@host2 \ -t ssh -L 6010:localhost:6010 user3@host3 It will prompt you with ...
vdi's user avatar
  • 141

Only top scored, non community-wiki answers of a minimum length are eligible