pikaur
pikaur copied to clipboard
Config option to prevent running as root
I would like to have a configuration option that prevents me from running pikaur as root. I want to always use the same directories in my home, but when running pikaur as root it would use different directories.
The option would work like this if I accidentally run pikaur as root:
$ sudo pikaur -S pikaur
Error: Do not run pikaur as root!
$ pikaur -S pikaur
...
what about adding an option "Disable systemd dynamic users"?
I think it easy for you @Ape do create a function in your .bashrc which check before running pikaur thanks to command whoami
e.g.
if [whoami == root];
pikaur;
else
the same could be done upstream, with a behaviour like this:
is root?
no -> continue
yes -> check config option:
config option enabled (default) -> stop execution of pikaur
config option disabled -> just print a warning
If someone had to implement this what files would they need to work with? I am assuming pikaur/config.py
@sakshatshinde pikaur/config.py and pikaur/main.py
To whom it may concern: A function in your .bashrc will not work, since sudo pikaur runs pikaur as root and not as you.
I worked around this by adding !/usr/bin/pikaur to my entry in the sudoers file: thus, my system prints an error message instead of allowing me to run sudo pikaur.
This is not secure—see "Limitations of the ‘!’ operator" in the sudoers manual entry—but is sufficient to prevent accidents.
fixed in 99fa4549e9f25661c65c7c031027033c9be3dadc