Can I configure Fedora 22 so anything needing root privileges asks for a password, rather than giving an error, and needing me to re-run with sudo? I wouldn't even mind having to type my password every time, without the few minute (or whatever it is) timer that it remembers the password for.
i.e. Instead of:
$ dnf history
You don't have access to the history DB.
It would:
$ dnf history
[sudo] password for <username>:
I think some of the gui apps do that, like the gui yum frontend back when I had that installed.
I'm thinking not… That it would be up to each app to implement this. But, I'm hoping it might instead be that apps say root privilege is needed, and there might be some way for the kernel (or wherever else) to remain in a blocking input stage (for the password) before returning whether the user has access.
Best Answer
You could use the python script
thefuck
available on github. This script is designed to correct the last command you ran incorrectly for a few use cases and forgetting to usesudo
is one of them.From their examples:
This behavior is from the sudo rule you can enable:
If this doesn't work out of the box for
dnf
it should be straightforward to create a custom rule to do so.