Hello World,
Following up on our previous post on how to change the GDM background through a script on Ubuntu operating systems, someone tried to run the script on Debian and didn’t work as expected. First because Debian is not in the list of supported/tested operating systems. Secondly, because Debian and Ubuntu does not use the same configuration settings for the GDM. So, in order to quickly provide a solution for this user running Debian 13, willing to change the GDM background, we have “forked” our existing Change-GDM-4.1 script to make it work against Debian 13.
Again, we didn’t put too much effort in this activity because it seems that other tools can be used to perform the same change through a command line or even better through a GUI. The script has not been tested extensively but should be working on most Debian 13 systems.
Change-Gdm-Background Script – Debian Version 1.0
Overview
This Change-gdm-background script can be used to customize the background image you see at the login screen of Debian 13 operating System. There are probably other ways or tools that can be used to change the login screen background image. However, since someone asked if it was possible to change the GDM background on Debian, we have decided to provide a sperate script at this stage
- support Debian 13 only (and best effort only)
- support Ubuntu distribution that run Gnome Desktop
- can run multiple times
- provides a basic GUI interface to have a more friendly experience
- allows you to set either a solid color or a picture as background image
- The GUI offers you the possibility to easily revert back changes if needed
How to Use the Script
Disclaimer
The script is provided AS IS ! Use it at your own risk !!!
Download the script
To download the script, you have multiple options. You can from a Terminal issue the following command
wget https://www.c-nergy.be/downloads/ChangeGDM/Change-Gdm-Background-Debian-1.0.zip
You can also simply use your browser and click on the link to download the script :
Unzip the File
After downloading the zip package containing the file, you will need to unzip it first. To unzip the package, you can use the Terminal console and issue the following command
unzip Change-Gdm-Background-Debian-1.0.zip
You can also use the GUI and the Nautilus file manager to select the downloaded package, right-click on it and select the option Extract Here
Set Execute Right on the script
After downloading the script and extracting from the zip, open a Terminal console. From the Terminal console, we will mark the script as executable. To mark the script as executable, you simply navigate to the location where the script is located and you issue the following command
chmod +x Change-Gdm-Background-Debian-1.0.sh
Execute the script
In the Terminal console, Browse to the location where the script has been stored and then issue the following command
./Change-Gdm-Background-Debian-1.0.sh
You will see some output in your Terminal console and you should be prompted for a password.
Click on Picture for better Resolution
After entering the password, the GUI part of the script will start and you should be presented with the following dialog box
Click on Picture for better Resolution
As you can see, you can decide to use a solid color for the login background settings or you can decide to use your favorite picture to be used at login screen. Make your choice between solid color or picture and proceed with the wizard. Let’s assume that you want to use a picture for the GDM background, you will select the background picture option and press ok
The File Browser dialog box will open and you will be able to easily browser and locate the image to be used. When selected, Press OK
Click on Picture for better Resolution
Again, a new Dialog Box will be displayed asking you to either reboot the server completely or to simply restart the GDM service. Select your preferred option and Press OK. This step is mandatory in order to visualize the changes made at the login screen…..
Click on Picture for better Resolution
After rebooting or restarting the GDM service, you should see your new customized login screen and you can proceed with the login process
Click on Picture for better Resolution
Final Notes
Voila ! This is it for this post !
This is a fast publishing post in order to quickly respond to a request we have received. As you can see, we have adapted and forked our original script that allows you to customize the Ubuntu GDM background. This quick updated script will allows you to customize the GDM Background color or image on Debian 13 operating Systems.
This script has not been tested extensively but seems to work quite well. If you detect some issues or bugs with the script, please let us know and we will try to fix it but with no guarantee.
I see already the next request.. would it be possible to merge these scripts into a single one and basically add support for Debian operating system. As we have no time at the moment, and since there are other options available to change GDM Background, we are not planning to merge them. If there are really a lot of requests, we might consider updating the script in the future…
Till next time
See ya
Annex – The Script in plain text….
#!/bin/bash
##########################################################################
# Script_Name : Change-Gdm-Background-Debian-1.0.sh #
# Description : Change background image of the GDM Login screen #
# on Debian 13 #
# Date : May 2026 #
# written by : Griffon #
# Web Site :https://www.c-nergy.be - https://www.c-nergy.be/blog #
# Version : 1.0 #
# History : 1.0 - Add support for Debian 13 #
# #
# Disclaimer : Script provided AS IS. Use it at your own risk.... #
# You can use this script and distribute it as long as #
# credits are kept in place and unchanged #
# #
##########################################################################
#---------------------------------------------------#
# Generate Log file #
#---------------------------------------------------#
# Name of the file
LOG_FILE="change-gdm-script_$(date +%Y%m%d_%H%M%S).log"
# Redirect what you see in the screen in the log file specified above
exec > >(tee -a "$LOG_FILE") 2>&1
#---------------------------------------------------#
# Variables and Constants #
#---------------------------------------------------#
#--Automating Script versioning
ScriptVer="1.0"
gdmpath="gnome-shell"
version=$(lsb_release -sd)
#---------------------------------------------------#
# Script Version information Displayed #
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;36m
!----------------------------------------------------------------!
! Change-Gdm-Background script - Ver. $ScriptVer !
! Written by Griffon - May. 2026 !
! www.c-nergy.be !
!----------------------------------------------------------------!
\e[0m"
/bin/echo -e "\e[1;38m
!----------------------------------------------------------------!
! Disclaimer !
! !! Script provided AS IS. Use it at your own risk.!! !
!----------------------------------------------------------------!
\e[0m"
echo
#--------------------------------------------------------------------------#
# -----------------------Function Section - DO NOT MODIFY -----------------#
#--------------------------------------------------------------------------#
#---------------------------------------------------#
# Function 0 - check for supported OS version ....#
#---------------------------------------------------#
check_os()
{
echo
/bin/echo -e "\e[1;33m |-| Detecting Ubuntu version \e[0m"
#--Initialize variable to check if OS supported or not
oschk=""
#--Define array of Supported OS
array=("Debian GNU/Linux 13 (trixie)")
for element in "${array[@]}"; do
if [[ $version == *"$element"* ]]; then
#-- Supported OS
oschk=Supported
fi
done
if [[ "$oschk" == "Supported" ]]
then
/bin/echo -e "\e[1;32m |-| Debian Version : $version\e[0m"
call_gui_choice
gdm_update
gdm_compile
else
/bin/echo -e "\e[1;31m
!--------------------------------------------------------------!
! Your system is not running a supported version !
! The script has been tested only on the following versions !
! Debian 13 !
! The script is exiting... !
!--------------------------------------------------------------!
\e[0m"
echo
exit
fi
}
#--------------------------------------------------------------------#
# Function 1 - Display GUI for Change Login script #
#--------------------------------------------------------------------#
call_gui_choice(){
#------ Selection Dialog Box Displayed ----------------------------#
echo
/bin/echo -e "\e[1;33m |-| Starting Wizard Interface \e[0m"
cbxChoice=$(zenity --list \
--height=400 \
--title="Login Screen Background Changer" \
--text "What do you want to do ?" \
--radiolist \
--column "Choice" \
--column "Description" \
FALSE "Solid color as background" \
FALSE "Picture as background" \
FALSE "Revert back to default" 2>/dev/null)
#---------Check which option has been selected - Color/picture/Nothing------#
if [[ $cbxChoice = "Solid color as background" ]];
then
/bin/echo -e "\e[1;32m |-| Solid color selected..Proceeding\e[0m"
selectcolor=$(zenity --color-selection --show-palette 2>/dev/null)
if [ -z "$selectcolor" ]
then
/bin/echo -e "\e[1;31m |-| No color has been chosen..Exiting\e[0m"
exit
else
/bin/echo -e "\e[1;32m |-| Solid color ........ : $selectcolor \e[0m"
fi
elif [[ $cbxChoice = "Revert back to default" ]];
then
/bin/echo -e "\e[1;31m |-| Resetting Debian default settings\e[0m"
sudo mv /usr/share/gnome-shell/gnome-shell-theme.gresource.bak /usr/share/gnome-shell/gnome-shell-theme.gresource
call_gui_rboot
echo
elif [[ $cbxChoice = "Picture as background" ]];
then
/bin/echo -e "\e[1;32m |-| Picture Selected...Proceeding\e[0m"
pix=$(zenity --file-selection --title="select the new login image" 2>/dev/null)
if [ $? -eq 1 ]
then
/bin/echo -e "\e[1;31m |-| No Image Selected...Exiting\e[0m"
echo
exit
else
#--Get the File Name only not the full path -----##
fname=$(basename "$pix")
fi
else
/bin/echo-e"\e[1;31m |-| No option Selected...Exiting\e[0m"
echo
exit
fi
}
#--------------------------------------------------------------------#
# Function 2 - Reboot function #
#--------------------------------------------------------------------#
call_gui_rboot(){
cbxReboot=$(zenity --list \
--height=400 \
--title="Restart GDM Service or Reboot ?" \
--text "Select which option is best for you?" \
--radiolist \
--column "Choice" \
--column "Description" \
FALSE "Reboot Now (Recommended)" \
FALSE "Restart GDM service" 2>/dev/null)
#---------Check which option has been selected - Color/picture/Nothing------#
if [[ $cbxReboot = "Reboot Now (Recommended)" ]];
then
/bin/echo -e "\e[1;32m |-| want to reboot....;:-) \e[0m"
sudo reboot
elif [[ $cbxReboot = "Restart GDM service" ]];
then
/bin/echo -e "\e[1;32m |-| Restart GDM service....;:-) \e[0m"
sudo service gdm restart
else
/bin/echo-e"\e[1;31m |-| Nothing here..... \e[0m"
echo
exit
fi
}
#--------------------------------------------------------------------#
# Function 3 - Update css file on Ubuntu 20.04 or later #
#--------------------------------------------------------------------#
gdm_common()
{
# Step 1 - Install prereqs for compilation later on
sudo apt-get -y install libglib2.0-dev-bin
sudo apt-get -y install libxml2-utils
#--Define some Variable
workdir="${HOME}/shell-theme"
xmlfile=${workdir}/custom.gresource.xml
echo
/bin/echo -e "\e[1;33m |-| Deleting Directory Structure \e[0m"
if [ -d ${workdir} ]; then
rm -rf ${workdir}
fi
echo
/bin/echo -e "\e[1;33m |-| Creating Directory Structure \e[0m"
if [ ! -d ${workdir} ]; then
mkdir -p ${workdir}
fi
echo
/bin/echo -e "\e[1;33m |-| Creating xml file for compilation step \e[0m"
bash -c "cat >"$xmlfile <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/theme">
EOF
echo
/bin/echo -e "\e[1;32m |-| Populate xml file... \e[0m"
#--Extract Resources -- Important location
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource
for r in `gresource list $gst`; do
gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell\/theme/}
if [ $? -eq 0 ]
then
echo " <file>"${r#\/org\/gnome\/shell\/theme/}"</file>" >>$xmlfile
fi
done
#Close the file
echo "</gresource>" >>$xmlfile
echo "</gresources>" >>$xmlfile
}
#--------------------------------------------------------------------#
# Function 4 - GDM Compilation Function #
#--------------------------------------------------------------------#
gdm_compile()
{
/bin/echo -e "\e[1;32m |-| Compile Resource File...\e[0m"
cd ${workdir}
glib-compile-resources custom.gresource.xml
echo
/bin/echo -e "\e[1;33m |-| Backing up orginal GDM Files... \e[0m"
if [ "/usr/share/gnome-shell/gnome-shell-theme.gresource" ]; then
sudo cp /usr/share/gnome-shell/gnome-shell-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource.bak
fi
/bin/echo -e "\e[1;32m |-| Copy new gresource file...\e[0m"
sudo cp ${workdir}/custom.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource
/bin/echo -e "\e[1;33m |-| Applying Changes... \e[0m"
echo
/bin/echo -e "\e[1;33m |-| Rebooting or Restarting GDM Service... \e[0m"
#Reboot Server or Restart GDM Service ...
call_gui_rboot
}
gdm_update()
{
#common code to run
gdm_common
echo
/bin/echo -e "\e[1;32m |-| Modifying $gdmpath.css file...\e[0m"
if [ -z "$selectcolor" ]
then
echo
/bin/echo -e "\e[1;32m |-| Copying Picture to working Directory... \e[0m"
cp "$pix" ${workdir}
/bin/echo -e "\e[1;32m |-| Update xml file... \e[0m"
sed -i '/<gresource prefix="\/org\/gnome\/shell\/theme">/a \ <file>'${fname}'</file>' $xmlfile
echo "
#lockDialogGroup {
background: #2c001e url('resource:///org/gnome/shell/theme/${fname}');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
.login-dialog-not-listed-button {
color: #f2f2f2;
background-color: transparent;
padding: 0 6px;
margin: 6px; }
.login-dialog-not-listed-button:focus {
color: #f2f2f2;
box-shadow: inset 0 0 0 0px #ef8661 !important;
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-not-listed-button:focus:hover {
background-color: #3c3532; }
.login-dialog-not-listed-button:hover {
color: #f2f2f2;
background-color: rgba(0, 0, 0, 0.1875);}
.login-dialog-not-listed-button:active {
color: #f2f2f2;
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-not-listed-button:active:hover {
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-not-listed-button:active:focus {
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view {
width: 25em;
-st-vfade-offset: 3em; }
.login-dialog-user-list-view .login-dialog-user-list {
margin: 0 8px;
spacing: 12px; }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item {
color: #f2f2f2;
background-color: transparent;
border-radius: 6px;
padding: 9px; }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:selected, .login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:focus {
color: #f2f2f2;
box-shadow: inset 0 0 0 0px #ef8661 !important;
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:selected:hover, .login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:focus:hover {
background-color:rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:hover {
color: #f2f2f2;
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:active {
color: #f2f2f2;
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:active:hover {
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:active:focus {
background-color: rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item .user-icon {
border: 2px solid rgba(0, 0, 0, 0.1875); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item .login-dialog-timed-login-indicator {
height: 2px;
margin-top: 6px;
background-color: rgba(242, 242, 242, 0.7); }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:logged-in .user-icon {
border-color: transparent; }
.login-dialog-user-list-view .login-dialog-user-list .login-dialog-user-list-item:logged-in .user-icon StIcon {
background-color: rgba(211, 70, 21, 0.3); }" | tee -a ${workdir}/$gdmpath-{light,dark}.css
else
echo "
#lockDialogGroup {
background-color: ${selectcolor}; }" | tee -a ${workdir}/$gdmpath-{light,dark}.css
fi
}
#--------------------------------------------------------------------#
# Function 4 - Update css file on Ubuntu 24.04 #
#--------------------------------------------------------------------#
#--------------------------------------------------------------------#
# Function 6 - Show Credits #
#--------------------------------------------------------------------#
sh_credits() {
/bin/echo -e "\e[1;36m
!-----------------------------------------------------!
! Change-Gdm-Background - Version : $ScriptVer !
! Written By - Griffon - May 2026 !
! !
! Web :www.c-nergy.be - www.c-nergy.be/blog !
!-----------------------------------------------------!
\e[0m"
echo
}
#--------------------------------------------------------------------------#
# -----------------------END Function Section -----------------#
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
#------------ MAIN SCRIPT SECTION -------------------#
#--------------------------------------------------------------------------#
#---------------------------------------------------#
#-- Step 0 - Try to Detect Ubuntu Version....
#---------------------------------------------------#
version=$(lsb_release -sd)
codename=$(lsb_release -sc)
#Trick to get prompted for sudo password - Nothing will be logged
sudo touch gdmlogin.log
#Call Check OS Function to validate OS Version
check_os
#End of script - Show Credits
sh_credits