How can I use Remote Desktop to connect to a sleeping Ubuntu machine and wake it up?
I have a laptop running Ubuntu 24.04.1 LTS that I would like to access with Remote Desktop (or VNC)[1] from a Mac. I found the Ubuntu system settings to enable Remote Desktop and am able to connect from the Mac using the RDP client published by Microsoft (vaguely named "Windows App") when the Ubuntu machine is active (I'm logged in and the machine is not locked). I should mention that today is the first time I've had a Linux machine or used the Ubuntu desktop, though I've accessed Linux machines via ssh
in the past to do command-line stuff. (In other words: comfortable in bash
, new to the Ubuntu desktop.)
I stay logged in all the time on the Ubuntu machine, but usually it is not "awake" -- I left it idle and it auto-locked and the screen shut off. (I don't know if I should be calling that state "lock", "sleep", or "hibernate".) If it's not awake, connecting with the RDP client immediately fails; I don't get a chance to type anything. (I expected to have to type my password to unlock it.)
Since the machine is in the same room, I thought I could mitigate this by touching a key on the Ubuntu machine to get it to show the lock screen and then make the connection and unlock. However, the client can't connect in that state either. I have to type my password on the Ubuntu machine to unlock it, and only then can I connect using the RDP client.
I would like to be able to stick the Ubuntu machine somewhere out of the way, leaving it on and logged in, and interact with it only remotely. How can I make a remote connection when the machine is not awake?
Some further details:
-
I can connect through
ssh
when the machine is not awake. If there's something I can do viassh
to wake the machine up so that RDP would then work, that's acceptable. -
The Ubuntu machine is an older laptop with some glitchy keys in the keyboard. I can probably type a password on it to unlock if I have to, but I'd rather not.
-
The machine isn't going to be moved around. I was planning to plug it in and leave it logged in on my home network. If disabling the auto-locking when idle would help, I'm open to that. (I don't yet know how.) I'd like to avoid having the screen on all the time, though. Ideally, the machine would be closed, unlocked or remotely unlockable, and available for remote connections.
-
I already had a VNC client on the Mac, so I first tried to set up a VNC server on the Ubuntu machine. I've read that a VNC server is built in, but the documentation I found didn't match the settings I see, which say only RDP, not VNC. I don't care which I use, now that I've gone and gotten the other client, but mention this in case my problem is better solved through VNC and that is actually possible. ↩︎
1 answer
With the help of some community members in chat (thanks!), I was able to solve this and learned stuff in the process.
I'm not the first person to run into this issue; there is a Gnome extension that fixes it. I didn't know Gnome had extensions. To deploy this, first install the Gnome extension manager:
sudo apt-get install gnome-shell-extension-manager
This adds Extension Manager under "Show Apps". Open that, choose the "Browse" tab, and search for "Allow Locked Remote Desktop". After I installed and enabled this extension, remote connections behave as I expected: the remote client connects and I can type a password to unlock.
I am aware that Gnome is not the only UI/window manager available on Linux. At the time I asked the question I didn't know this was Gnome, the default. I don't know if the problem is specific to Gnome or if it's more general and this is only a partial answer.
1 comment thread