27 votes
Accepted

ssh -R make target host accept connection on all interfaces

By default, it will listen on localhost (loopback interface) only. You need to specify the bind_address as 0.0.0.0 in your command: ssh -R 0.0.0.0:2222:localhost:22 TARGET -N You need also to ...
Khaled's user avatar
  • 36.9k
25 votes

How to add local forward setting to my ssh config file?

I think, you have differently defined command and config. In command, you are using localhost and in config, IP address (12.34.56.78). This should works for you: Host myhost User myuser ...
dorinand's user avatar
  • 359
24 votes
Accepted

SSH access gateway for many servers

That's too complicated (checking if a key has access to a specific prod server). Use the gateway server as jump host that accepts every valid key (but can easily remove access for a specific key ...
Sven's user avatar
  • 99.5k
22 votes
Accepted

How can I use port tunneling to connect to a private database instance through a network bastion?

When you create an SSH tunnel, it does not expose the opened port to the outside world. The opened port, is only available as localhost. So effectively what you've done is to create a tunnel from your ...
Matt Houser's user avatar
  • 10.2k
18 votes

Forward SSH through SSH tunnel

As of OpenSSH 7.3 (late 2016) the easiest way is the ProxyJump setting. In your ~/.ssh/config: Host B ProxyJump A Or on the command line, -J B.
arantius's user avatar
  • 311
16 votes

What is the difference between Local/Remote/Dynamic SSH tunneling?

I have drawn some sketches The machine, where the ssh tunnel command is typed (or in your case: Putty with tunneling is started) is called »your host«. static (options -L local and -R remote) local: ...
erik's user avatar
  • 291
15 votes
Accepted

SSH: What's the difference between -L and -R?

It's right there, in the man page: -L Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the ...
Gerald Schneider's user avatar
15 votes
Accepted

ssh -R binds to 127.0.0.1 only on remote

While the local optional bind address is at the control of SSH's client side (specified with -L/LocalForward or altered with -g/GatewayPorts in the client's configuration), the remote optional bind ...
A.B's user avatar
  • 12.5k
12 votes
Accepted

SSH Local Port forwarding working from localhost only

Are you aware that you type 4122 in the example? You should try -L *:4420:172.88.3.31:22 The star implies that you listen on all addresses, and not localhost, which you cannot connect to from ...
Martin's user avatar
  • 303
11 votes

how to solve the "open failed: administratively prohibited: open failed" when using a SSH tunnel proxy

There is a broader discussion of this error with SSH tunnels on Unix StackExchange. In a nutshell, this is a non-specific error; there are numerous possibilities that should be explored.
eye's user avatar
  • 159
11 votes
Accepted

Add temporary entry to hosts, when tunnelling SSH

I have a solution for you, wrap your ssh command into a bash script: #!/bin/bash function control_c { echo -en "\n## Caught SIGINT; Clean up /etc/hosts and Exit \n" sed -i '' "/internal-wiki/...
Marcel's user avatar
  • 1,780
11 votes

SSH access gateway for many servers

Engineers should not be running ansible directly from their laptop, unless this is a dev/test environment. Instead, have a central server that pulls the runbooks from git. This allows for additional ...
Henk Langeveld's user avatar
10 votes
Accepted

How to SSH tunnel with keys

Despite the authentication method used, SSH tunneling works the same way. The problem here is not about using public key authentication but understanding the basics of How to Use SSH Tunneling. Your -...
Esa Jokinen's user avatar
  • 49.7k
10 votes
Accepted

How to add local forward setting to my ssh config file?

The syntax of the ssh_config file was correct - so the error had to be somewhere else. The command line which worked was: ssh 12.34.56.78 -L 8888:localhost:8000 but in the LocalForward directive, you ...
Martin's user avatar
  • 2,374
9 votes
Accepted

Working example of multiple permitopen options in authorized_keys

I've gotten it to work. The first example above works. permitopen="host-1:3389",permitopen="host-2:3389" ssh-rsa AAAAC... In my case it was not working because the host name is case-sensitive. I ...
Shawn McGough's user avatar
9 votes
Accepted

RDP equivalent to SSH port forwarding?

No, it is not possible with RDP. You can install an SSH server on windows and continue to use SSH. Alternatively, you can use netsh to do TCP forwarding as described in this answer on SO: netsh ...
Gerald Schneider's user avatar
8 votes

with SSH only: reverse tunnel web access via ssh SOCKS proxy

Newer versions of SSH allow to use the very simple option of ssh -R <[bind_address:]port>. Using only the port on the host and maybe the bind address, but not specifying the client side port ...
Richard Metzler's user avatar
8 votes
Accepted

Connection to postgresql hangs over SSH tunnel on OSX

I believe you have postgresql configured to listen only on loopbavk (localhost). You should use the forwarding like this: ssh -L 5433:localhost:5432 user@serverip Otherwise it will try to connect to ...
Jakuje's user avatar
  • 10k
8 votes

access an http server as localhost from an external pc over ssh

The right syntax for create an SSH tunnel is this one: ssh -L local_port:remote_address:remote_port [email protected] So according to your output the command should be something similar to this: ...
DarkVex's user avatar
  • 428
7 votes

how to tunnel Windows Remote Desktop through ssh using a linux box?

One can use internal ssh tunneling from Remmina remote desktop client too. If you can ssh to some linux server using ssh keys and that server have open 3389 (RDP) port for packets coming from your ...
andrej's user avatar
  • 503
7 votes
Accepted

Allow SSH Reverse Tunneling (-R), but not Local Forwarding (-L)?

sshd_config man page has it all: AllowTcpForwarding Specifies whether TCP forwarding is permitted. The available options are yes (the default) or all to allow TCP forwarding, no ...
Tomek's user avatar
  • 3,553
7 votes
Accepted

Is it possible to have multiple users SSH tunnel to a same local port?

Definitely. You can easily try this with your own user. Just open up two terminals and start two SSH sessions to proxy that same server port. Session #1: ssh -L 8080:127.0.0.1:80 ssh-user@server....
siwyd's user avatar
  • 86
7 votes

How to ssh-copy-id through a jump-host? Something similar to the -J option with ssh command

Have you tried defining the jump connection in ~/.ssh/config and then attempting the ssh-copy-id? I seem to recall doing something like that a few years ago to work around not being able to use the ...
Stygge's user avatar
  • 101
6 votes

SSH Reverse Port Forward Bind to address

In order to make it bind to all interfaces, use: ssh -N -R 0.0.0.0:2695:localhost:22 [email protected] Don't forget to edit /etc/ssh/sshd_config and go to GatewayPorts and enable it and set it to ...
Mohamad Osama's user avatar
6 votes

Is there any way to log entered password from ssh?

You can visualize the failed user names after you turn up the verbosity of the log in sshd_config¹, but there is no way to see the failed passwords as this could be a potential security issue and ...
Jakuje's user avatar
  • 10k
6 votes
Accepted

SSH jumping with aliases and "-F"

According to this SuperUser entry, from version 7.3p1, there is an Include directive, so you can create a config file which includes your "regular" config, but has all the ProxyCommand entries. This ...
Lacek's user avatar
  • 7,433
6 votes

SSH jumping with aliases and "-F"

For proxy hosts you don't need ProxyCommand anymore. There is a new option ProxyJump, which does the same without the need of another ssh with configuration. It will internally issue the same command, ...
Jakuje's user avatar
  • 10k
6 votes
Accepted

Speed up mongodump+mongorestore

Don't know why I didn't think of it: ssh *** ". /etc/profile; mongodump --host=127.0.0.1:27017 --db=**** --archive --gzip" | mongorestore --host=127.0.0.1:27017 --drop --archive --gzip Was 1603.96 ...
warvariuc's user avatar
  • 368
6 votes

Which command is used to establish ssh tunnel in windows?

I sense confusion and a possible misunderstanding. When you establish a SSH tunnel with: ssh user@server -L 5900:localhost:5900 ...the following things happen: a SSH connection is established and ...
telcoM's user avatar
  • 4,588
6 votes

ssh port forwarding with firewall-cmd

You could try firewall-cmd --add-forward-port: firewall-cmd --permanent --add-forward-port=port=222:proto=tcp:toaddr=172.x.x.x:toport=22 firewall-cmd --reload General syntax (https://firewalld.org/...
mwfearnley's user avatar

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