2

I am running Ubuntu 16.04 and I would like to prevent my workstation from sleeping even when nobody is logged localy on the machine. This workstation is often used through ssh.

I would like to set that through the command line.

Best regards, François

InsideLoop
  • 121
  • 3

2 Answers2

4

Open the dash and search for power:

Unity dash searching for power

Open the "Power" option.

Pick the following options:

System power settings set to not suspend or sleep

That should do it.

Azendale
  • 11,891
  • Thanks. But my graphic card makes compiz crash when using the Gnome/Ubuntu desktop. It there a way to do that with command line? – InsideLoop Jan 28 '18 at 19:33
2

Terminal CLI method

OP requests a CLI (Command Line Interface) methodology.

For battery timeout:

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout <time_in_seconds>

For AC timeout:

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout <time_in_seconds>

So for both Battery and A/C set the time to 0 (never).

For Login screen:

gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
  • I am not using Gnome but Xfce4 and I need to disable sleep even when nobody is logged in. – InsideLoop Jan 28 '18 at 20:40
  • @InsideLoop I think XFCE is based on GNOME. The gsettings are persistent across reboots. Try the answer and let me know if it doesn't work. Also is the system suspending or the screen simply turning off when inactive? There is a different setting for that too. – WinEunuuchs2Unix Jan 28 '18 at 20:44
  • @InsideLoop I added the login screen to the answer. – WinEunuuchs2Unix Jan 28 '18 at 23:35