On an almost fresh install of Ubuntu 12.04, after disabling screen turning off, screen lock, and suspension on inactivity from all the (two) places one can find under Ubuntu's System Settings, the screen still turns black after some minutes of inactivity. I can't tell for sure whether it only becomes blank/black or turns off.

I've uninstalled gnome-screensaver, which didn't change anything.

Of the several answers I found out there (most of which I didn't try because they were either unclear or reported to not work for everybody), I tried one that DID work:

sudo xset s off

After which I left the computer unattended for hours and the screen never turned black, so it definitely worked.

However, it does not survive a reboot. After reboot, screen starts turning black again after N minutes of inactivity.

Given that xset s off does work until reboot, how do I make that setting permanent?

I guess I could create a script that runs at startup issuing that command, but I think that would be a horrible hack and there should be a cleaner way to accomplish this.

3 Answers 3


Just add it to your .xsessionrc or .xinitrc file.


If you have admin rights, you can make the setting system-wide in the Xorg server configuration files with option BlankTime, for example by creating /etc/X11/xorg.conf.d/50-my-screensaver.conf:

Section "ServerFlags"
    Option "BlankTime"  "0"

Note that the time unit here is minutes, not seconds as with xset, and that 0 means off.

More information about corresponding options between xset and the Xorg configuration (DPMS as well, for example) can be found in the manual page for xorg.conf.

Option "BlankTime"  "time"

sets the inactivity timeout for the blank phase of the screensaver. time is in minutes. This is equivalent to the Xorg server's -s flag, and the value can be changed at run-time with xset(1). Default: 10 minutes.

-- man xorg.conf (Xorg X server 1.20.4)


This behavior is initiated at login and overrides the command if run at boot. To make this permanent, just add the lines below to the end of the .profile in your Home folder.

# Turn off screen blanking
xset s off && xset -dpms

If you don't see .profile, open your Home folder in your file browser, click on 'View' and select 'Show Hidden Files'. Then just right click on .profile, select 'Open with text editor', copy and paste the above on a blank line at the end of the file and save the modified file.

  • ahh I didn't know I had to do this to survive reboots, thanks!
    – Alex
    Apr 6, 2021 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.