6

What does it mean to give a process CAP_SYS_RAWIO in linux? How do I do that? (Specifically to give pyUsb access to devices. This is related to this pyusb question)

Community
  • 1
  • 1
jedierikb
  • 12,752
  • 22
  • 95
  • 166

1 Answers1

8

From the capabilities(7) man page:

  CAP_SYS_RAWIO
          Perform I/O port  operations  (iopl(2)  and  ioperm(2));  access
          /proc/kcore.

Capabilities are set on an executable with setcap(8).

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • Note that `CAP_SYS_RAWIO` can be trivially leveraged to give root anyway, so you might as well just keep using root. – caf Nov 12 '10 at 03:51
  • so... for launching a python app trying to access usb... I would set these capabilities on the command line when launching? (sorry, I am out of my element here) – jedierikb Nov 12 '10 at 04:04
  • 1
    `setcap cap_sys_rawio=ep foo` would work if `foo` were an executable, but not if it's a (Python or other) script. You could make your own wrapper or use `capsh`, but as Ignacio says, that's pretty much the same as running as root anyway. – ephemient Nov 12 '10 at 05:39
  • Does this also work for USB serial devices? (The ones in `/dev/serial/*`)? – CMCDragonkai Aug 29 '16 at 11:02