VsCode dropping ssh connections frequently with remote server - visual-studio-code

I'm facing a weird problem after connecting with the remote host using ssh in VSCode, the editor lost the connection after some seconds with the remote server (in this case a droplet in Digital Ocean). But when I open an ssh connection with the remote server using my local terminal instead of my local VSCode of my I do not see the same thing happen, in the terminal the connection keep alive for minutes, as expected.
Perhaps an ssh config on a remote server? I don't think so because using the terminal the problem doesn't occur.
So, what fix I can apply to my local VSCode configuration to stop this behaviour?

Related

Avoid cancel of postgresql script when losing connection to server due to VPN session closing

I'm trying to execute a remote postgresql script by command line (connecting to the server via putty) by using
\i myscript.sql
The problem comes when the script takes several hours to complete and VPN connection to the server (and consequently putty session) close. I can't really control that part because it's a local security policy. The session closing makes the execution of the script to cancel.
Is there an easy way to let the script run in the server regardless I'm still connected to it?
After you putty in use GNU screen or one of its equivalents like tmux before you run psql. This will preserve your session when you get disconnected so you just reconnect to it next time you log in.
You can reduce the TCP keepalive idle time on your client operating system to have the client send “keepalive packets” regularly, which keeps the misconfigured firewall from closing the connection.
Start psql using the connection string syntax:
psql 'host=... port=5432 user=... dbname=... keepalives_idle=60s'

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

how to solve the error of DBeaver database?

I used DBeaver (database management tools) and faced this type of error
It looks like you're trying to connect to a MySQL instance over SSH. Most likely issue is that the remote server isn't accepting SSH connections. If you try the following at a command line, can you establish a connection? (Bash if you're using Linux, putty if you're on Windows)
ssh <user>#<remotehost>
Also it's important to mention that you probably have two sets of credentials you're using here. The credentials to connect to the SSH server are not necessarily the same as the credentials to connect to the MySQL database.

Authentication by identity file failed with error code -18

I received this error when trying to establish an SSH tunnel using pgAdmin3
I specified the private key location on my local machine (had to
enable hidden files on my Mac finder to see it),
entered the tunnel
host (used public host IP) and
checked the 'Identity file' option.
I don't have a password set on my key.
Received this error:
Authentication by identify file failed with error code -18
What am I doing wrong (or what do I need to do differently)?
I was getting this continously on windows (VM).
So I decided pgAdmin's built in ssh tunnel was no good and just used gSTM (On linux).
Forwarding the port from the remote server 5432 to local host 5555 worked.
Then I could just use pgAdmin III on Linux to connect.
You could probably use command line like this if you don't want to use a graphical tool such as gSTM.
ssh -fNg -L 5555:localhost:5432 {your_username}#{yourdomain.com}
Source: http://dustindavis.me/ssh-tunnel-in-pgadmin3-for-postgresql/
You can also use putty on windows to forward ports.
See Connection | SSH | Tunnels menu in the PuTTY Configuration.
http://www.akadia.com/services/ssh_putty.html
Then you can access it.
Of course be very carefull messing about in a remote database.
It is a good idea to label them a red or orange colour in pgAdmin to easily identify the ones that are not on your local network.

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..