Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BashScripts/turn-off-monitors: Issue with sudo in the script after the screen is black #10

Open
lamyergeier opened this issue Nov 6, 2024 · 1 comment

Comments

@lamyergeier
Copy link

lamyergeier commented Nov 6, 2024

Laptop: Fedora 41, Gnome 47, Wayland


After turning off the keyboard and mouse event function is executed which runs a command on sudo, but after the screen is dark, its difficult to type the password.

Is it recommenced to add entire script to /etc/sudoers or just stdbuf? Any risks?


appending lamy lamyer =NOPASSWD: /usr/bin/stdbuf to /etc/sudoers is not enough as

$ whoami
lamy
$ hostname
lamyer
$ stdbuf -oL libinput debug-events | while read -r line; do
>         case "$line" in
>             *"KEYBOARD_KEY"*)
>                 echo "KEYBOARD_KEY"; return 0;
>                 ;;
>             *"POINTER_BUTTON"*)
>                 echo "MOUSE_CLICK"; return 0;
>                 ;;
>             *"POINTER_MOTION"*)
>                 echo "MOUSE_MOVED"; return 0;
>                 ;;
>         esac
>     done
Failed to open /dev/input/event13 (Permission denied)
Failed to open /dev/input/event0 (Permission denied)
Failed to open /dev/input/event1 (Permission denied)
Failed to open /dev/input/event3 (Permission denied)
Failed to open /dev/input/event4 (Permission denied)
Failed to open /dev/input/event5 (Permission denied)
Failed to open /dev/input/event7 (Permission denied)
Failed to open /dev/input/event9 (Permission denied)
Failed to open /dev/input/event10 (Permission denied)
Failed to open /dev/input/event8 (Permission denied)
Failed to open /dev/input/event11 (Permission denied)
Failed to open /dev/input/event12 (Permission denied)
Failed to open /dev/input/event15 (Permission denied)
Failed to open /dev/input/event16 (Permission denied)
Failed to open /dev/input/event17 (Permission denied)
Failed to open /dev/input/event18 (Permission denied)
Failed to open /dev/input/event19 (Permission denied)
Failed to open /dev/input/event20 (Permission denied)
Failed to open /dev/input/event2 (Permission denied)
Failed to open /dev/input/event6 (Permission denied)
Failed to open /dev/input/event14 (Permission denied)
Failed to open /dev/input/event21 (Permission denied)
Expected device added events on startup but got none. Maybe you don't have the right permissions?
@hopeseekr
Copy link
Owner

hopeseekr commented Dec 8, 2024

Try this. It's in my /etc/sudoers:

## Allow sudo-run commands to inherit the callers' ConsoleKit session
Defaults env_keep += "XDG_SESSION_COOKIE"

I experience this same problem with Wayland before I could get the libevent code to work. I suggest that your user is missing a group.

Here are my groups:

bumblebee network power vboxusers nvidia-persistenced nordvpn docker users video storage render optical disk audio wheel adm tsmith input

I'd suggest that you add your user to the input group so it has permissions to /dev/input/*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants