I ran into this interesting scenario. Say you want to install and use the program sxiv
, then normally this requires admin privileges:
$ dnf install sxiv
The requested operation requires superuser privileges. Please log in as a user with elevated rights, or use the "--assumeno" or "--downloadonly" options to run the command without modifying the system state.
Now if instead you try to run the non-existing program, the system will suggest to install it. When agreeing to this, it will install the program with requiring to raise the privilege:
$ sxiv
bash: sxiv: command not found...
Install package 'sxiv' to provide command 'sxiv'? [N/y] y
* Waiting in queue...
* Loading list of packages....
The following packages have to be installed:
sxiv-26-11.fc41.x86_64 Simple (or small or suckless) X Image Viewer
Proceed with changes? [N/y] y
* Waiting in queue...
* Waiting for authentication...
* Waiting in queue...
* Downloading packages...
* Requesting data...
* Testing changes...
* Installing packages...
usage: sxiv [-abcfhiopqrtvZ] [-A FRAMERATE] [-e WID] [-G GAMMA] [-g GEOMETRY] [-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] FILES...
$ ls -la /usr/bin/sxiv
.rwxr-xr-x@ 83k root 20 jul 2024 /usr/bin/sxiv
What exactly happens here? How is the program installed as root without entering any credentials?