Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2130  / 2 Years ago, tue, june 14, 2022, 4:54:09

In order to prevent someone (other than me) from changing my background, how can I make wallpaper changing an action requiring a password?


More From » password

 Answers
0

This turned out to be a nice challenge. Try,



$ sudo mv /usr/bin/gsettings /usr/bin/gsettings2
$ sudo gedit /usr/bin/gsettings
$ sudo chmod +x /usr/bin/gsettings


When gedit comes up on the second instruction, add:



#!/bin/bash
if [ "$1" == "set" ] && [ "$2" == "org.gnome.desktop.background" ] && [ "$3" == "picture-uri" ]; then
a=$(zenity --entry="Password")
h1=$(/bin/echo $a | /usr/bin/md5sum | /bin/cut -f1 -d" ")
h2='a799d7cf3d9ca647f1320fc6bfaf7408' #Password hash
if [ "$h1" == "$h2" ]; then
gsettings2 set org.gnome.desktop.background picture-uri $4
else
zenity --notification --text="Wrong password. Come again another day"
fi
else
$(gsettings2 $@)
fi


To undo,



$ sudo rm /usr/bin/gsettings
$ sudo mv /usr/bin/gsettings2 /usr/bin/gsettings


You can go to this md5 generator, put your string and replace a799d7cf3d9ca647f1320fc6bfaf7408 with whatever you like. Try finding out for yourself what this corresponds. You'll realize how secure this is.



Even if somebody views this file, without your password they cannot change it (This is similar to how linux stores your passwords :P).


[#22999] Wednesday, June 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ttarum

Total Points: 417
Total Questions: 101
Total Answers: 115

Location: Maldives
Member since Wed, Nov 4, 2020
4 Years ago
ttarum questions
Sat, Aug 20, 22, 12:42, 2 Years ago
Wed, Sep 28, 22, 18:07, 2 Years ago
Mon, Feb 7, 22, 20:23, 2 Years ago
;