Change lock screen background through command line

For me (Ubuntu 15.10 with default Unity) it is working nicely with the following command:

One time necessary:

gsettings set com.canonical.unity-greeter draw-user-backgrounds false

For change picture:

gsettings set com.canonical.unity-greeter background '/path/filename_of_picture.png'

Changed the lock screen immediately. - like Serg mentioned above. In Ubuntu 15.10 (Unity) lightdm is there by default, so just the above mentioned command needed.

Tested with:

xdg-screensaver lock

command which immediately locks the computer.

I just tried in terminal (not from background, like cron), but I am pretty sure it works that way as well.


I've tried a thousand and one different approaches, and the only one that actually worked for me without issue was simply overwriting the file it is on. It'll take JPEGs and PNGs, but maybe other files as well. However, the filename, including the file extension, must be the same. Here's the path:

/usr/share/backgrounds/warty-final-ubuntu.png