1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 17:22:10 +02:00
tldr/pages/linux/setcap.md
Vítor Henrique 4f75ffc1db
pages*: make "See also" conform to the new syntax (#12756) (#12354)
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: spageektti <git@spageektti.cc>
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2024-06-03 22:21:58 +02:00

832 B

setcap

Set capabilities of specified file. See also: getcap. More information: https://manned.org/setcap.

  • Set capability cap_net_raw (to use RAW and PACKET sockets) for a given file:

setcap '{{cap_net_raw}}' {{path/to/file}}

  • Set multiple capabilities on a file (ep behind the capability means "effective permitted"):

setcap '{{cap_dac_read_search,cap_sys_tty_config+ep}}' {{path/to/file}}

  • Remove all capabilities from a file:

setcap -r {{path/to/file}}

  • Verify that the specified capabilities are currently associated with the specified file:

setcap -v '{{cap_net_raw}}' {{path/to/file}}

  • The optional -n root_uid argument can be used to set the file capability for use only in a user namespace with this root user ID owner:

setcap -n {{root_uid}} '{{cap_net_admin}}' {{path/to/file}}