I'm building a desktop application in node.

The application requires access to USB devices through the usb library. To access USB periphery, I must run my application as root with sudo npm run for instance.

This situation is quite unsatisfactory, I was wondering if it is possible to keep the application running as the regular user and then simply ask the user for a password once access is required.

An application with a similar feature is the Raspberry Pie imager, which asks the user for their password, once a target device is selected (usually an SD card, etc). It does not run as root otherwise.

I'd like to implement a similar way of dealing with hardware access by my application.

0

There are 0 best solutions below