I won't say I have a good solution but I did manage to cobble together something that clumsily works. Here is the part of my bash script that runs in a loop over a set of users, with the user account name in the variable unm
and where I have a bunch of image files pre-setup in a consistent naming scheme. It relies on having crudini
installed.
The display manager login avatar per user is handled as:
cp avatar_$unm.png /var/lib/AccountsService/icons
touch /var/lib/AccountsService/users/$unm
crudini --set /var/lib/AccountsService/users/$unm User Icon "/var/lib/AccountsService/icons/avatar_$unm.png"
The display manager login background per user is handled as:
mkdir -p /var/lib/AccountsService/backgrounds
cp wallpaper_$unm.jpg /var/lib/AccountsService/backgrounds
crudini --set /var/lib/AccountsService/users/$unm org.freedesktop.DisplayManager.AccountsService BackgroundFile "'/var/lib/AccountsService/backgrounds/wallpaper_$unm.jpg'"
Note that these are independent of the equivalent settings that each user can make from inside their account. I'm not especially seeing that as a bad thing.
This is from one part of some (still minimal) stock setup scripts that I use for fresh installs. See the repository at ubuntu_accounts_setup
Notably for this thread, see the file: set_avatars_users_xubuntu_2204.bash