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

Why does discover need sudo? #28

Closed
WhyNotHugo opened this issue Apr 12, 2022 · 4 comments
Closed

Why does discover need sudo? #28

WhyNotHugo opened this issue Apr 12, 2022 · 4 comments

Comments

@WhyNotHugo
Copy link
Contributor

I notice that blueman-manager can discover devices with bluez without being root. Why does bluez-rs need sudo permissions for discovering?

@laptou
Copy link
Owner

laptou commented Apr 23, 2022

Technically, it needs the CAP_NET_RAW capability. I suspect that system utilities are able to get this capability automatically via setuid or a similar mechanism, but that's not really practical for development purposes.

@eduardoheleno
Copy link

How can i use sudo to execute de start_discovery function?

@WhyNotHugo
Copy link
Contributor Author

Ah, indeed, other tools simply rely on bluez which entirely runs as root.

@WhyNotHugo
Copy link
Contributor Author

@EduardoPD1921 sudo can only be used to elevate the privileges of an entire process, not just one function. If you have a larger program that you'd rather not elevate, you might need a SUID helper or something like that.

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

3 participants