GETCAP(8)

๐Ÿ“ฆ
version 2.78 ยท 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– getcap ๐Ÿ’–

okay bestie, this is the manual page for getcap, the System Manager's Manual entry, and it's giving "check your file's powers" energy ๐Ÿ”โœจ

โœจ NAME โœจ

getcap โ€” examine file capabilities ๐Ÿฆ‹

๐ŸŒธ SYNOPSIS ๐ŸŒธ

getcap [-v] [-n] [-r] [-h] filename [ ... ]

๐Ÿ’… DESCRIPTION ๐Ÿ’…

okay so getcap is the tool that shows you the name and capabilities of each file you hand it. literally just point it at a file and it spills the tea on what powers that file has ๐Ÿซถ

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -h โ€” prints quick usage ๐Ÿ“
  • -n โ€” prints any non-zero user namespace root user ID value that's attached to a file's capabilities ๐Ÿงš
  • -r โ€” turns on recursive search ๐ŸŒˆ
  • -v โ€” displays all the searched entries, even the ones that have no file-capabilities ๐Ÿ‘€
  • filename โ€” one file per line ๐Ÿ“„
โš ๏ธ NOTE: an empty value of = is NOT the same as an omitted (or removed) capability on a file, bestie. this matters most for the Ambient capability vector ๐Ÿ˜ญ a process with Ambient capabilities will lose them when it executes a file that has = capabilities, but it will keep the Ambient inheritance of privilege when it executes a file with an omitted file capability. so this special empty setting can be used to stop a binary from running with privilege ๐Ÿ”’ the kernel honored this suppression for root executing the file for a while, but after a number of years the kernel developers decided this was unexpected for the superuser and reverted it just for that user identity ๐Ÿ’€ suppression of root privilege for a process tree is still possible using the --mode option of capsh(1) ๐Ÿ™ˆ

๐Ÿซถ REPORTING BUGS ๐Ÿซถ

ngl if something's broken, report it here, periodt ๐Ÿ’œ

https://bugzilla.kernel.org/buglist.cgi?component=libcap&list_id=1090757

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

capsh(1), cap_get_file(3), cap_to_text(3), capabilities(7), user_namespaces(7), captree(8), getpcaps(8) and setcap(8) โœจ


that's the whole tea, bestie! ๐ŸŽ€ it's the 2021-08-29 GETCAP(8) page from the System Manager's Manual, and you're literally iconic for reading it ๐Ÿ‘‘๐Ÿ’–

๐Ÿ“ฆ where this page comes from