How to Change Login Screen Background in Ubuntu 18.04

Last updated: May 6, 2024

gnome shell

Boring with the default purple login screen background in Ubuntu 18.04? Well, here’s how to make a change by hacking the css file.

UPDATE 2024: This tutorial is outdated and only work for old Ubuntu 18.04!! For most recent Ubuntu versions, see this tutorial instead!

Ubuntu since 17.10 switches to Gnome 3 Desktop and GDM display manager. Although there are options to change desktop wallpaper and lock screen background (it’s actually screen saver with date & time displayed), the login screen is always purple.

In the picture above, I’ve changed the login background to the image “Aardvark_Wallpaper_Grey_4096x2304.png” locate in /usr/share/backgrounds.

1. Move your favorite image to /usr/share/backgrounds:

It’s better to move the image you want to set as login background to system pictures folder: /usr/share/backgrounds.

To do so, open terminal via Ctrl+Alt+T, then either run command:

sudo cp PATH/TO/YOUR/IMAGE /usr/share/backgrounds/

or run command to open file browser via root and then do copy and paste in that window:

xhost +local: && sudo nautilus /usr/share/backgrounds/

2. Edit the css file that define GDM login background:

Open terminal (Ctrl+Alt+T) and run command to edit file /etc/alternatives/gdm3.css, which is linked to /usr/share/gnome-shell/theme/gdm3.css:

xhost +local: && sudo gedit /etc/alternatives/gdm3.css

Input your password (no visual feedback while typing) when it prompts and hit Enter. And of course back up the file before editing.

3. When the file opens, go to menu (right after ‘Save’ button) -> find and find out following section:

#lockDialogGroup {
  background: #2c001e url(resource:///org/gnome/shell/theme/noise-texture.png);
  background-repeat: repeat; }

change the lines into:

#lockDialogGroup {
  background: #2c001e url(file:///usr/share/backgrounds/Aardvark_Wallpaper_Grey_4096x2304.png);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center; }

Replace Aardvark_Wallpaper_Grey_4096x2304.png with your picture file name.

Finally save the file and restart your computer to apply changes.

NOTE: these changes may be overwritten in case of an system update with GDM packages. Please let me know if you find a good way to change the GDM3 login background in Ubuntu 17.10.


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via Buy me a coffee:

20 responses to How to Change Login Screen Background in Ubuntu 18.04

  1. Thanks for this. The damn Ubuntu purple at login is so hideous. Unfortunately, it does get overwritten. I just wish there was Ubuntu based distro with a clean GNOME experience.

  2. Lifesaver :)

  3. Thx! I hope it will be configurable in the next LTS

  4. This is my contribute for Ubuntu 17.10 (unlock and login ROOT user)– First open a Terminal and run sudo passwd root — to change the root password, then …sudo vim /etc/gdm3/custom.conf– Under [security] type AllowRoot = true so that it looks like[security]
    AllowRoot = true– Save and exit. Then runsudo vim /etc/pam.d/gdm-password– Within this file you have comment out the line containingauth required user != root quiet_success– so that it looks like this#auth required user != root quiet_success– Save the file and exit and reboot.– At next reboot You’ll get an alert about ‘/root/.profile’ so You have to copy — a new profile from ‘/etc/skel/.profile’ to the root folder, or — from ‘/usr/share/base-files/dot.profile’.sudo cp /usr/share/base-files/dot.profile /root/.profile– root’s files are copied from base-files: if they’re missing,
    — its postinst copies /usr/share/base-files/dot.bashrc to /root/.bashrc
    — and /usr/share/base-files/dot.profile to /root/.profile.
    — Additionally, if /root/.profile matches one of the recorded checksums
    — (which means it hasn’t been changed by the administrator), it is updated on upgrade.
    — The same applies to /etc/profile and /etc/nsswitch.conf– (including updating on upgrade), and /etc/motd.– Then edit it to apply this modify (add rows) :sudo vi /root/.profile — Add these … and saveif `tty -s`; then
    mesg n
    fi– Reboot system and choice different user type (root) …
    — END

    • I’m not going to assume I know what your personal computing needs are and you might have a really good reason to do this but usually it’s a bad idea to have your whole session running as root and quite unnecessary.

      If you just want to be able to access and edit your protected root files, you could always use pkexec to start Nautilus and gEdit with root privileges. There’s a nice guide here on how to do that:

      When you launch Nautilus as root, you’ll have access to completly different settings and can make bookmarks that are related to managing your PC. You can launch all your Linux applications as root by going to /usr/share/applications and double clicking an icon there. For example you can launch gnome tweak tool and give root a different gtk theme or launch dconf editor and tweak Nautilus’ root preferences which you usually can’t access via the shell.

  5. Thx for the HowTo.

    There’s still an annoying purple background popping up for a split second when logging in though.

    I thought that perhaps changing

    background: #2c001e …… (which should be Ubuntu purple)
    background: #000000 …… (e.g. black)

    beside changing just the image reference, would do the trick.

    I didn’t manage.

    You guys have any ideas?

  6. Just did this on 4.13.0-17 – worked like a charm! Appreciate this!

  7. I also suggest to change this in the same gdm3.css:

    .login-dialog-user-list:expanded .login-dialog-user-list-item:selected {
    /*background-color: #dd4814; */
    background-color: #000000;

    because i don’t like orange background on user selection ( change #000000 to the hex color code that you like )

    • Its possible to make same background as in article, instead of #000000. Just copy all strings from article into it.
      Looks nice, I have replace both login screen and lock screen with this.

  8. I still have purple flash for 0.5 seconds when I enter password, press login, before my wallpaper and desktop shows up. Any idea how to remove that?

  9. Hey, is anyone else getting blank screen occasionally instead of the wallpaper you put?

    • I think I’ve figured out what was wrong (it was driving me crazy): it seems to that the lockscreen isn’t always using the #lockDialogGroup reference from /etc/alternatives/gdm3.css. It seems that sometimes it will use the #lockDialogGroup reference found in /usr/share/gnome-shell/theme/gnome-shell.css (if you’re using the default Ubuntu gnome shell theme). If you’re using a custom gnome-shell theme, you’ll need to edit the gnome-shell.css file found in ~/.themes/NAMEofCUSTOMtheme/gnome-shell. OP, please update your tutorial.

      • The default session uses /usr/share/gnome-shell/theme/ubuntu.css in my case which is linked to /etc/alternatives/gdm3.css.

        And the left pane is hard coded in Ubuntu 17.10, so I don’t think gnome-shell themes are totally usable in the default Ubuntu session unless you’re using Gnome-shell upgraded from Ubuntu 17.04.

  10. Oh, man – I’ve changed three different copies of this style sheet as indicated by the commenters with no luck – still a dumb purple screen.

    • Have you changed ‘resource’ to ‘file’?

  11. Victor Bolshov May 2, 2018 at 7:47 pm

    Cool, man! Finally I got a StarMan / Tesla / Don’t Panic wallpaper everywhere!

  12. Thanks for the information. It works just fine for Ubuntu 18.04 LTS as well. Cheer!!!