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

Last updated: January 5, 2024 — 5 Comments

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.

UPDATE 2024: There’s NEW GRAPHICAL TOOL to configure Gnome Login Screen, see GDM Settings.

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 - https://github.com/PRATAP-KUMAR/ubuntu-gdm-set-background/archive/main.tar.gz | 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.

Twitter

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 ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

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

  1. Andrew DeFaria April 19, 2023 at 8:54 pm

    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?

  2. Hi all
    i made the things that are written and it proceeded well.But the picture on the lock-screen is far to big,about 4 times bigger than if it would fit the Monitor.The original picturesize on my compurer is about a sixth of the monitorscreen.How is it to calibrate ? Will it make sense to expand the original image to fit size and change then ? Or is it possble to shrink that
    picture that is used for lockscreen? sorry about my humble english

    • Try resizing your image:
      1. open “Files” and navigate to the folder that contains your image file.
      2. right-click on blank area in that folder and select “Open in terminal”.
      3. In pop-up terminal window, run command to install imagemagick tool:

      sudo apt install imagemagick

      4. Finally, resize your image to fit screen size:

      convert file_name.png(.jpg) -resize 1920x1080 output.png

      In last command, you may drag & drop the original image file into terminal instead of typing “file_name.png”. And, change 1920×1080 depends on your screen resolution (see it in ‘Displays’ setting page).

  3. i get this error bash: src/pre-23.sh: No such file or directory

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*