boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.77k stars 433 forks source link

Don't sudo on Linux #528

Closed Furinkazan33 closed 2 years ago

Furinkazan33 commented 2 years ago

In order to avoid using sudo (wich is bad), I recommend changing the user or the group of the keyboard dev file after the installation process so that the corresponding users can use this keyboard module without beeing root.

For example : sudo chown my_user:root /dev/input/by-path/platform-i8042-serio-0-event-kbd or sudo chown root:my_user_group /dev/input/by-path/platform-i8042-serio-0-event-kbd

and then check with a cat (ctrl-c to quit) : cat /dev/input/by-path/platform-i8042-serio-0-event-kbd

=> Please add this step in the installation doc and remove the root check in the code.

Furinkazan33 commented 2 years ago

I just see that the correction has been made in the code. I get keyboard module from pip which is not up to date. Can you please update the module in pip ?

By the way, which is the best in your opinion, changing the file attributes or adding the input group to the user ?

adabru commented 2 years ago

Can you please update the module in pip ?

pip install git+https://github.com/boppreh/keyboard.git

changing the file attributes or adding the input group to the user ?

It seems like the same security implications to me. And adding to the input group is more convenient. But I'm not an expert.

Furthermore I think this issue is a duplicate of https://github.com/boppreh/keyboard/issues/312.