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

Using with sudo instead of a setuid binary #2

Open
colemickens opened this issue Oct 13, 2021 · 3 comments · Fixed by JasonGantner/wshowkeys#5
Open

Using with sudo instead of a setuid binary #2

colemickens opened this issue Oct 13, 2021 · 3 comments · Fixed by JasonGantner/wshowkeys#5

Comments

@colemickens
Copy link

On NixOS, it's impossible to have suid binaries in the store, we prefer to run such apps with sudo.

However this app doesn't support that. What would be required?

~/code/nixpkgs-wayland-- dev ⇡
❯ ./result/bin/wshowkeys
wshowkeys needs to be setuid to read input events

~/code/nixpkgs-wayland-- dev ⇡
❯ sudo !!                    
sudo ./result/bin/wshowkeys
devmgr: failed to drop root

~/code/nixpkgs-wayland-- dev ⇡
❯ 
@lorenzleutgeb
Copy link

Running into the same issue. Did you find any workaround or alternative to wshowkeys?

@schauveau
Copy link

Wayland applications can be run as root by abusing the fact that root can access all files and so the user's wayland socket. However, wshowkeys will still fail while trying to drop its 'setuid' status so the code need to be modified. Look in devmgr.c for the instruction that prints devmgr: failed to drop root and then comment out the next return 1; statement

Once this is done, you should be able to run wshowkeys as follow

sudo /bin/env WAYLAND_DISPLAY=$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY XDG_RUNTIME_DIR=/user/run/0 ./build/wshowkeys

@JasonGantner
Copy link

Can you check if my PR (JasonGantner#5) works as expected for you?

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

Successfully merging a pull request may close this issue.

4 participants