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

CLI handles USB device permission errors badly #162

Closed
emilazy opened this issue Sep 28, 2019 · 5 comments
Closed

CLI handles USB device permission errors badly #162

emilazy opened this issue Sep 28, 2019 · 5 comments
Labels
feature-request Meta: feature request

Comments

@emilazy
Copy link
Contributor

emilazy commented Sep 28, 2019

If you run Glasgow as a user that can't access the USB device under Linux, you get a usb1.USBErrorAccess: LIBUSB_ERROR_ACCESS [-3] backtrace; it should print something more useful about running it with sudo or installing the udev rules. (Relatedly, Glasgow should probably drop permissions after opening the USB device when run as root.)

@whitequark
Copy link
Member

Relatedly, Glasgow should probably drop permissions after opening the USB device when run as root.

I'm not sure if this works. Suppose you run it in a Docker container--you have to be root then, I think, or you can't write anywhere in it.

@whitequark whitequark added the feature-request Meta: feature request label Sep 28, 2019
@emilazy
Copy link
Contributor Author

emilazy commented Sep 28, 2019

Well, it should at least drop its privileges after opening everything it needs to. This is good practice even for daemons that need to have access to root-permissioned files. However, it's hard to implement, and given that the CLI just plain crashes and dies if you try to run it in anything that isn't a proper pty with width and height it can determine, I'm not sure glasgow.cli-in-Docker-with-pid-namespaces is the most convincing use-case.

@whitequark
Copy link
Member

Well, it should at least drop its privileges after opening everything it needs to.

You can't do that. An applet can decide to write a file right before termination, and it might not even know the name of this file beforehand (e.g. you're reading a floppy into track-1.raw, track-2.raw etc).

@whitequark
Copy link
Member

Also, it works just fine for me in Docker? I actually test the installation instructions that way.

@whitequark
Copy link
Member

The error that you get now (since commit 26ba5e7) is this:

$ glasgow list
E: g.device.hardware: missing permissions to open device 001/113

The documentation includes instructions for installing the udev rules file that should work, as far as I know, for any remotely modern Linux distribution (including eudev-based ones), so I consider this finished.

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

No branches or pull requests

2 participants