I have a desktop that has Elementary installed. I often use the desktop remotely, over SSH through local LAN or with Tailscale, but I am often disconnected from my session when using SSH. I found this SE answer about it disables suspending and sleeping completely.

Is there a way to disable suspend/sleep when using SSH?

  • I don't know anything about Tailscale. Does it offer you the chance to add a command to your login?
    – KGIII
    Commented Nov 29, 2020 at 3:42
  • You should configure SSH on the server. More info here tinyurl.com/grbjqnb
    – Guest
    Commented Nov 29, 2020 at 5:47
  • I'm considering removing the Tailscale ref as it is not helpful. Tailscale is built on Wireguard but has a nice wrapper. I am trying to prevent suspend/sleep when I am connected remotely via SSH (no matter how I retrieved the IP)
    – Jason M.
    Commented Nov 29, 2020 at 17:10

1 Answer 1


You can use something like systemd-inhibit to block sleep/suspend while you're running the command. This has the express benefit of being a dynamic solution, rather than masking the calls entirely.

Eg: systemd-inhibit --what=sleep --mode=block ssh

I use this to stop my machines from shutting down while my backups are running. Once the command completes, it stops blocking sleep.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.