I installed Ubuntu on a laptop that I wanted to use just as a SSH server. But when the laptop lid is closed it would suspend, where as I wanted it to be alive.
Open the login manager configuration file:
$ sudoedit /etc/systemd/logind.conf
Uncomment the line with HandleLidSwitch=suspend
and change it to HandleLidSwitch=ignore
.
Other possible options for this config are poweroff
and hibernate
.
Restart the service:
$ sudo systemctl restart systemd-logind
Tried with: Ubuntu 22.04