Recently, I build up a server in my home network from old hardware that was around. I choose the Debian GNU/Linux distribution and set up the operating system.

Since I wanted to use the server in interactive mode with a GUI as well as via ssh whenever I need it, I noticed that the server was going to hibernate. Hence the ssh daemon (sshd) is down, I was unable to access the server without waking it up.

In order to prevent the sleep mode, the following command creates symlinks to /dev/null.

root@server:$ sudo systemctl mask \ 
    sleep.target \ 
    suspend.target \
    hibernate.target \
    hybrid-sleep.target

This can be reverted as follows:

root@server:$ sudo systemctl unmask \ 
    sleep.target \ 
    suspend.target \
    hibernate.target \
    hybrid-sleep.target