Nested ssh connection - visual-studio-code

I want to connect via ssh to the server and from this server connect to another server via ssh. Do you know if there are any extensions that would allow me to do so?

Can you just use
ssh -t userid1#machine1 "ssh userid2#machine2"
assuming that you have a ssh client on the first target?

Related

Connection to remote server via file client

I have little problem. I am using Putty for connection to remote server.
ssh xxx.xx.xxx.xxx
After connection and login with password, I need to use command:
ssh username#servername
After this, I can use remove server via Putty, its work fine.
Now, I am looking for solution how to connect filemanager (WinSCP). I can connect to xxx.xx.xxx.xxx and browse filesystem here, but I cannot use secont ssh command for connection to computing server filesystem. How to solve this? Can I somehow open filemanager in Putty session location?
It looks like, that the connection tunneling feature from WinSCP is what you are looking for: https://winscp.net/eng/docs/tunneling

Is there any possibility to establish a SSH tunneling from the server using the postgresql to the client

I have one server machine where PostgreSQL and SSH server is installed. I have another client machine from where i want to connect to the PostgreSQL on the server machine in a secure way. I used SSH tunnel which is working.
I tried to connect the client with server using:
$ ssh -L 3307:localhost:3306 user#Host -N -f
It is working. But now I am thinking whether it is possible to start the ssh tunneling from the server side. It means run a ssh command on server machine so that I get a more secure connection

How do I do mongodump on a server and transfer that to my local machine using golang?

I wrote a go program ( which is basically the code in this example, Simple SSH port forward in Golang ) that connects to a remote mongodb server by creating an ssh tunnel. I can query the server using mgo api. Now, instead of querying the server everytime, I want to copy a few collections of the database to my local machine and query locally. It is important to note that I cannot copy it directly to my local machine as there is port forwarding involved. How can I achieve this ?
You are reinventing the wheel. Use cron to create an ssh tunnel to the destination and then use a local mongodump to connect against your local tunnel endpoint
ssh -f user#mongodb.example.com -L 27017:mongodb.example.com:27017 -N
mongodump localhost:27017 <your opts here>

How to do SSH tunneling with docker (machine & compose)?

I have a mongoDB container running on an instance built with docker-machine, maintained with docker-compose. The mongoDB process isn't exposed to external traffic.
I want to connect to the remote mongoDB server using a GUI tool installed locally and without exposing any ports on the remote machine.
What's the best way to do this? Is there any way I can tunnel the connection via ssh with the docker-machinie ssh command?
What's the best way to do this? Is there any way I can tunnel the
connection via ssh with the docker-machinie ssh command?
Yes. Per the docs, docker-machine invokes the standard OpenSSH client. You can use the same -L syntax that you'd normally use for SSH tunneling. The end of the doc has an example using port 8080.

Using multiple terminals on a remote machine using a single SSH connection

I'm running a process on a remote server through SSH on a certain port. The process is basically a TCP server waiting (listening) for a connection. So as long as it is running I cannot use the terminal as it is a blocking application.
I want to run another application (a TCP client) through the same instance of SSH connection to connect to that TCP server. I used screen to detach the first process (TCP Server) and connect to the server but then I could not see the output of the TCP server application.
Is there a way to emulate two terminals on a remote machine using SSH?
So I found a solution to this problem. Basically below is a link that explains how can I achieve exactly what I needed. That is, opening multiple terminals using a single SSH connection.
http://idnotfound.wordpress.com/2008/01/14/multiple-terminals-in-a-single-ssh-session/
In short we can use the following procedure:
$ ssh -X mylogin#remotemachine gnome-terminal
Password: ...
[Ctrl+Z]
$ bg
$ exit
Press Ctrl+Shift+N to open a new terminal.
EDIT: Or just use screen. Sigh..