How to Change Login Screen Background in Ubuntu 22.04 [Another Script]

Want to change the background wallpaper or just set another color for Ubuntu Gnome login screen? Here’s how to do the trick in Ubuntu 22.04!

As you may know, the GDM background is not easy to modify since GNOME hard-coded the CSS into a .gresource file. Some scripts has been created in github to deal with it, but so far there’s no universal one that works on all Linux (or even all Ubuntu) editions.

I was waiting for the graphical GTK4 tool Login Manager, however, it never works and even breaks the login screen when I tried it in Fedora Workstation.

Change Login Screen Background in Ubuntu 22.04

For those still waiting for the maintainers to update their scripts, this one has been tested and works good in Ubuntu 22.04.

1. Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to install the required library:

sudo apt install libglib2.0-dev-bin

2. Now, paste the command below and hit run to download the script via wget:

wget -qO - | tar zx --strip-components=1 ubuntu-gdm-set-background-main/ubuntu-gdm-set-background

3. OK, now use command to change login screen background image:

sudo ./ubuntu-gdm-set-background --image /PATH/TO/YOUR/IMAGE

Tip: instead of typing file path manually, you may just drag & drop image file into terminal to insert its path

Or set another background color via command (replace #aAbBcC to your desired value):

sudo ./ubuntu-gdm-set-background --color \#aAbBcC

or set gradient color background via (replace horizontal to vertical as you want):

sudo ./ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF

As the terminal output indicates, press Ctrl+Alt+F1 (switch back via Ctrl+Alt+F2) to verify the changes or just restart your computer after saving your work.

Move the script to your PATH:

If you would like to use the script regularly, run the command below to move to “/usr/local/bin”:

sudo mv ~/ubuntu-gdm-set-background /usr/local/bin

Then, you may use the command at any time at any working directory via (change --image to --color or --gradient accordingly):

sudo ubuntu-gdm-set-background --image /PATH/TO/IMAGE

Known issue

As far as I know, it will NOT work if you do not type (or drop’n’drop) the FULL path to image. The last sudo command in previous picture didn’t work, as I navigated to image folder and type file name directly without path.

And if you use a remote image without pasting to local disk first, it may break your login screen so you’ll see the error screen as the bottom image shows.

How to Restore:

The script has a --reset option to restore the original blank background. To use it, just run:

sudo ./ubuntu-gdm-set-background --reset

Or use this command if you’ve move it into your PATH:

sudo ubuntu-gdm-set-background --reset

If the login screen is broken with error “Oh, no! Something has gone wrong …”, press Ctrl+Alt+F3 (~ F6) (right Ctrl+F3 ~ F6 for Virtualbox VM) to get into tty console. Then type username and password one by one to login, and run the previous reset command to restore.

Categorized as Howtos Tagged

By Ji m

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 remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via Buy me a coffee:

1 comment

  1. I used to run this and use an image file of /Pictures/current_wallpaper. This was a symlink to an image. On logout I’d run a script that picked another image from a list of login images and reset the symlink. This used to work in that every time I logged out I’d get a new background image. This no longer works. Not sure why. Perhaps it’s not following the symlink anymore. Maybe it makes a copy of the image file somewhere.

    Also, any way to get this to be essentially the lock screen?

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version