Login via SSH && suspend

My config looks like this:

  • disabled ssh.service and enabled ssh.socket
  • created ssh-no-sleep@.service
[Unit]
Description=ssh no sleep
BindsTo=ssh@%i.service

[Service]
User=1000
ExecStart=/usr/bin/gnome-session-inhibit --inhibit suspend --inhibit-only --app-id ssh --reason "ssh session "%I
PAMName=systemd-user

[Install]
WantedBy=ssh@.service
  • added an override for ssh@.service:
[Unit]
Wants=ssh-no-sleep@%i.service
  • added these to sshd config:
ClientAliveInterval 60
ClientAliveCountMax 5

So far I’ve been happy with it.

4 Likes