Renci SSH.Net Connect Cancel - ssh

I'm working with the Renci SSH.Net library and creating SSH and SFTP connections to devices. However, I don't see any way to cancel a connection that is in progress. For example, the user has mistyped the address they want to connect to and doesn't want to wait for the connection to time out.
Is there a way to cancel this connection or am I forced to wait for the timeout?

Related

Mobaxterm: how to keep sftp connection alive?

I kept ssh connection alive following this post:
Mobaxterm: how to prevent ssh session from exiting?
I managed to keep ssh connection alive but sftp connection on the left panel keeps disconnecting after a certain time while ssh is still alive and I have to every time reconnect the sftp. Sometimes, reconnect button on the left panel doesn't even work and I have to exit the shell and restart the ssh session again. What I want to achieve here is to keep the sftp connection (graphical browser on the left panel) alive in addition to ssh. Thanks.
I have the same problem, then I asked MobaXterm support and they gave me this answer:
You should update the SSH browser type to "SCP enhanced speed" mode. For this you can go to the settings of your SSH session, go to the advanced SSH settings and in the SSH browser type drop list choose SCP (enhanced speed).

Prevent sshfs reconnecting

I use sshfs to connect to a remote server. When my computer goes to sleep or internet drops, sshfs tries to reconnect when the connection comes back, but does not ask me for a password. Because of this, the reconnect fails, and after several attempts my IP address is blocked indefinitely from connecting to the server (until I convince them to unblock me). Overall this is completely untenable. How can I prevent sshfs from reconnecting? I am not using any of the ServerAliveInterval, ServerAliveCountMax, or -o reconnect options.

Start ssh in background on OpenWRT via ssh

Good morning,
I recently moved to the universities dormitory and they have a specific way how to enable the internet connection. They require me to connect to the network via Cable, set up a specific static IP and then enable the Internet connectivity by ssh'ing to a special IP with my own account and password. As long as this ssh session is open, the internet connection is active. If closed, then it is lost.
My setup right now is like this: I connected an OpenWRT-based TP-Link router (TP-Link TL-WR841N/ND v9) to the dormitory's network. My devices are connected to the router's wifi.
To get an internet connection, right now I am doing this:
connect to the router via ssh
connect to the internet via ssh on the router
So basically I am having two running ssh sessions. This is quite annoying as my laptop has to be on and running if I want to have an internet connection. My idea would be to keep the ssh session on the router running all the time. For this, however, I would need to keep the ssh session running in the background of the router.
Starting the second SSH with & skips the password entry. So I have to get it back to fg, enter the password and the process is back in the foreground. CTRL+Z appears to be not working on OpenWRT.
The only thing which could skip the password entry would be connecting with a key, but the server I am connecting to is not allowing that.
Anybody having other ideas?
You can do multiple things to solve this
Create a script(which will connect to internet) in router and schedule it in a cron job
If nohup/tmux is available in the router, execute the commands with them so that they keep alive when the ssh session is terminated.
So, looks like I solved the problem.
As nohup/tmux is not available on the router, I had to find an equivalent. Fortunately, screen is available for my router. With screen, you can start the ssh for the internet in a separate screen. When it's running, you can simply detach the screen and close the ssh to the router.
The ssh-connection for the internet will continue running in the background of the router.
The only drawback is that I have to reconnect manually, as soon as the router restarts.

Setup triggers in JProfiler for the remote connection

I have JProfiler 10 connected to the remote server via Quick Attach.
Is there a way to enable triggers to save snapshots on timer? So far I have been unsuccessful with getting this to work on remote connection.
It works as expected on local connections.
Don't use the "Quick attach" session, but create a new session of type "Attach to remote JVM" on the "New session" tab of the start center. Then, you can configure triggers for that session.

IP binding and VPNs

A problem encountered by VPN users is that when their VPN disconnects their IP is exposed. So I've decided to write a program that will kill open browsers when this happens. The idea is to check if the VPN is connected every something milliseconds (for example every 100ms).
My question is, will this be an effective method? During the intervals when this check is performed is there a chance the browser will make a connection to the site, therefore exposing the users IP?
Is data transfer interrupted between the browser and the web server? If so will the browser try to make another connection to the website or will it wait for the user to press refresh?