Avoid VS Code Remote having to reload window after Mac goes to sleep - macos

When connected to a remote SSH host and my Mac goes to sleep after a few minutes of inactivity, I have to reload the whole window to re-establish a connection when I return.
What's the least energy-inefficient way of avoiding this wait-time whenever the connection was cut due to inactivity? Is there a way to keep the session active (or reconnect to it more smoothly without having to reload the whole window) without disabling sleep mode on my Mac entirely? If not, is there a way to automatically disable sleep mode only when a VS Code remote session is active?

For me, this wasn't specific to VSCode. Rather, it was a general problem with using ssh from a Mac. You may find this helpful https://apple.stackexchange.com/a/251244
In particular, adding
host your.remote.host
ServerAliveInterval 180
to your ~/.ssh/config

Related

Is there a Mac App or command to autoconnect to SSH?

Right now I'm running a terminal with multiple tabs since I need to ssh into multiple servers to perform different tasks depending on the project. As I said I keep terminal up but it will eventually disconnect or some other hickup requiring me to either login back in or close and reopen terminal (and all my tabs/connections).
I'd like to either:
Open terminal type a command like "connect to webserver" and have it run the ssh command with password
Install an app that does this sort of thing and maybe has some extra functionality (not sure what that would be). Hopefully the app would auto connect and display windows for each connection I specify.
You should use vSSH Lite, Which is free for 2 tabs. Then you have to pay some amount.
Here is the link vSSH Lite

Windows server 2012 Log Off a remote desktop session without locking the screen

As in title. Is there any way to achieve this?
I have problem, because when you close remote desktop, gui and whole interface is being locked and any gui based applications or my autoit scripts won't work (they are crashing constantly).
I tried using 'tscon.exe' but this works only on windows server 2008.
I have the same issue, and I resolved it doing the following:
Connect to RD to your server with user "A"
From the remote computer, connect to RD to localhost to user "B" (create it if necessary)
From the new session, run anything you need.
Disconnect the FIRST session, with user "A".
In this way, the session running with user "B" will not be locked, and it will continue running your GUI controls.
Log off means the current session (created by logging in during RDP) is terminated. What you want is to keep the Logon Session live but disconnect the RDP.
Why not use AutoLogon to boot into console and run the scripts? However if the screen locks or someone RDPs and disconnects, the problem you are facing will reoccur.
What I have is to keep GUI and whole windows interface alive when i close remote desktop. Session is alive but gui and whole workstation is getting locked everytime I close rd.

Strange VNC Error Appears to Be Replicating Processes?

I'm running vnc into a server at work. It runs and doesn't crash, and I am able to use the terminal and whatever else, but the mouse stays in a circular 'thinking about it' state and I see the following at the bottom in the taskbar.
Anyone else who uses vnc to access the server sees the same behavior. Does anyone know a possible cause? Can provide more details if required! Just wondering if anyone has seen similar.
It appears as if the window list program was the culprit. Somehow it got stuck in a loop opening itself, and when closed, would reload itself almost immediately. Forcing a stop by killing the process(es) and denying a reload, and then rebooting the machine worked for me.
ps -ef | grep wmctrl
kill INSERT_PID_HERE

Is a mouse click on a remote desktop possible using AutoIt or alternatives?

I want to write a script that involves mouse click and stuff. I am little confused though. Is there a way mouse clicks (in the form of x and y co-ordinates) would work on a VPS which is logged on, but disconnected from the client?
Example:
MouseClick("left",588, 268)
To my knowledge, these VPSes don't have their own native screen resolution. I have already written the script for my local pc and it's working fine on my resolution. But when tried with the VPS, it doesn't work.
PS: I am running the script from the remote desktop itself and not from my local pc. Please correct me if there's anything I am doing wrong :)
Update: For anyone still looking for an answer, consider installing a vnc server, that way the screen resolution you specify is preserved even when not connected to the server.
Ex: https://www.realvnc.com/en/connect/download/vnc/
It's relevant to almost any automation tool, not only AutoIt.
Remote Desktop has its own GUI context only if it's connected to the remote PC. But you can lose focus for a Remote Desktop window (without disconnection & without minimizing) and continue other local work.
The same effect takes place for VNC server software.
One team in our organization uses it for massive test runs automation: a master server creates a remote session for each test machine and keeps them all connected until tests passes.
Use ControlClick to have the mouse click over RDP connections, even when you're not connected. For some reason it can still be iffy for me, but at least it worked more so that Click which was none at all.

Prevent lock of windows detecting user idle time

I work in a Windows Terminal Server enviroment where if you left the computer for a while, windows lock the session and terminal is power off.
What i need is the code needed to send a message to Windows for it to believe the user is in front of the PC (mouse or keyboard activity).
Thanks in advance
Can you run mstsc with the /console parameter? This will get you in console mode and wont time out. The screen will lock with the normal timeout, but you wont get disconnected. Be careful though, as anyone else trying to get into the console will then need to log you out in order to get on.
You can control session disconnect (connection is closed but session remains open and can be reconnected) and reset (connection and session are closed) timeouts via local or group policy.
Make sure screen saver on remote server and local PC is set to some ridiculous amount like 960 minutes (8 hours). Open a command prompt on the remote server. Tape the enter key down on your local keyboard. The system will interpret this as user activity. It won't affect performance or mess anything up. Any your boss will think you're working while you're off playing XBOX360, or watching a movie, or smooching with a co-worker in the emergency stairwell.

Resources