FILECAP:(8)

πŸ’– FILECAP πŸ’– (that's section 8 of the system administration utilities, bestie, and it's a whole vibe)


✨ NAME ✨

filecap β€” a program to see capabilities 🫢

okay so literally the whole point is peeking at which files have capabilities attached to them. iconic behavior tbh.


🌸 SYNOPSIS 🌸

filecap [ -a | -d | /dir | /dir/file [cap1 cap2 ...] ]

πŸ¦‹ DESCRIPTION πŸ¦‹

So filecap is this little program that prints out a report of programs with file based capabilities. That's it, that's the job. πŸ’…

And listen β€” if a file isn't in the report, or there's literally no report at all? That means no capabilities were found. No cap. It's giving "nothing to see here." πŸŽ€

Now here's the part where you gotta pay attention, bestie. For expedience β€” which is just a fancy way of saying "so it doesn't take forever" β€” the default is to check only the directories in the PATH environmental variable. So it's checking the places you're actually likely to run stuff from. Makes sense, right? Main character energy. πŸ‘‘

But then:

  • If you give it the -a command line option, then all directories will be checked. Like, the whole entire system. Go off. πŸ”₯
  • If you pass a directory, it will recursively check that directory. Recursive queen. 🧚
  • If you give it a path to a file, it will only check that file. Just that one. Nothing else.
  • And if a file is given followed by capabilities, then the capabilities are written to the file. ✍️ (yes this one actually changes stuff, so be normal about it)

πŸ’… OPTIONS πŸ’…

  • -a β€” This tells the program to show all capabilities starting from the / directory. Normally the PATH environmental variable is used to show you capabilities on files you are likely to execute. But with -a? We're going full sweep, no crumbs left. 🌈
  • -d β€” This dumps all capabilities for reference. Like a little encyclopedia of capabilities, but make it terminal. πŸ“šβœ¨

⭐ EXAMPLES ⭐

To check file capabilities in $PATH:

filecap

To check file capabilities of whole system:

filecap -a

To check file capabilities recursively in a directory:

filecap /usr

To check file capabilities of a specific program:

filecap /bin/passwd

To list all possible capabilities:

filecap -d

To set a file capability on a specific program:

filecap /bin/ping net_raw net_admin

To remove file capabilities on a specific program:

filecap /bin/ping none
πŸ’€ heads up bestie: that second-to-last one and the last one actually write to the file β€” setting caps with net_raw net_admin, and clearing them with none. The rest are just lookin'. Don't get it twisted. πŸ™ˆ

πŸŽ€ SEE ALSO πŸŽ€

pscap(8), netcap(8), capabilities(7).

go read those too, they're the friend group. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Steve Grubb


and that's the whole page, bestie πŸ’œ this one came out of <strong>Red Hat</strong>, dated <strong>Aug 2018</strong> β€” so yeah, it's a classic, it ate, and it's still serving. periodt. ✨🌸

πŸ“¦ where this page comes from