[artix-general] setcap assign permanently

Jeff Pohlmeyer yetanothergeek at gmail.com
Sat Sep 9 16:42:51 CEST 2023


On Sat, Sep 9, 2023 at 3:26 AM Xavier B. wrote:

> Mmmm... I desired more "definitive" solution ;-)

I guess it would go something like this...

1. Be root

2. Create the custom hooks directory if it doesn't exist:
     mkdir -p /etc/pacman.d/hooks

3. Create an empty hook file in that directory:
     touch /etc/pacman.d/hooks/dnscrypt-proxy.hook

4. Add these lines to your newly-created file:


[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = usr/bin/dnscrypt-proxy

[Action]
Description = Setting caps for dnscrypt-proxy...
When = PostTransaction
Exec = /usr/bin/setcap cap_net_bind_service=+pe /usr/bin/dnscrypt-proxy



5. Save the file and then re-install dnscrypt-proxy:
     pacman -S dnscrypt-proxy dnscrypt-proxy-openrc


6. Watch to see if pacman outputs the "Description" message from above.


7. Check the caps:
     getcap /usr/bin/dnscrypt-proxy


Note that the "Target" line in the hook file is missing the leading
slash. That is intentional.


 - Jeff


More information about the artix-general mailing list