Ubuntu – Disable sleep on laptop lid close in tty1


I'm using Ubuntu Desktop 15.10 on a laptop and it runs an Apache server with SSH as well. When using a GUI, I have the power options set to not sleep at all even when the laptop lid is closed, but recently I stopped the X-System and am now using TTY1 instead to save resources. However, in TTY1, if I close the laptop lid, the computer goes to sleep and prevents the SSH and Apache server from working. Any way to prevent this easily? The realistic answer I bet is to use Ubuntu Server instead (unless I'm mistaken and Ubuntu Server will also sleep on lid close) but I don't exactly want to switch yet unless there's an easy way to switch to it like you can switch from ubuntu-desktop to lubuntu-desktop? Any advice is welcome to prevent the computer from sleeping

Best Answer

Try to edit the /etc/systemd/logind.conf file and modify the line:




Then reboot.