Configure linux laptop to switch off screen but otherwise remain running when lid closed

Chris asked:

Hi i’m trying to set up an old laptop as a ‘server’ for testing purposes.

As such, I don’t want the screen on all day, however i do want the cpu running 24×7.

Can the ‘lid close’ switch be configured somehow to simply turn off the screen but otherwise the laptop is running as normal?

FYI: I’m running coreos, but i’m willing to switch to another docker container OS if it makes life easier.

My answer:

I’m not sure how you missed it in the docs, because when I looked it was plainly there.

Place this in logind.conf:


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.