Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use CAP_SYS_ADMIN

Can somebody please explain to me how to use or set CAP_SYS_ADMIN in c? I need that capability to unmount a usb drive but don't know how to use it.

like image 691
Ste Avatar asked Oct 22 '14 09:10

Ste


1 Answers

Here's how to do it using the command-line:

$  sudo setcap cap_sys_admin+ep executable-name

and

$ getcap executable-name
executable-name = cap_sys_admin+ep

You, of course, need the libcap package.

A good place to learn how to do it in C would be the source for setcap which is here

like image 54
starfry Avatar answered Nov 11 '22 09:11

starfry