# setcap - set file capabilities - man(8) - [phpMan]

[_SETCAP_(8)](https://www.chedong.com/phpMan.php/man/SETCAP/8/markdown)                              System Manager's Manual                             [_SETCAP_(8)](https://www.chedong.com/phpMan.php/man/SETCAP/8/markdown)

## NAME
       setcap - set file capabilities

## SYNOPSIS
       **setcap **[-q] [-n <rootuid>] [-v] {_capabilities|-|-r}_ _filename_ [ ... _capabilitiesN_ _fileN_ ]

## DESCRIPTION
       In the absence of the **-v **(verify) option **setcap **sets the capabilities of each specified _file‐_
       _name_  to  the  _capabilities_ specified.  The optional **-n <rootuid> **argument can be used to set
       the file capability for use only in a user namespace with this root user ID owner. The **-v **op‐
       tion is used to verify that the specified capabilities  are  currently  associated  with  the
       file. If -v and -n are supplied, the **-n <rootuid> **argument is also verified.

       The _capabilities_ are specified in the form described in [**cap_from_text**(3)](https://www.chedong.com/phpMan.php/man/capfromtext/3/markdown).

       The  special  capability string, **'-'**, can be used to indicate that capabilities are read from
       the standard input. In such cases, the capability set is terminated with a blank line.

       The special capability string, **'-r'**, is used to remove a capability set from  a  file.  Note,
       setting  an  empty capability set is **not the same **as removing it. An empty set can be used to
       guarantee a file is not executed with privilege in spite of the fact that the prevailing  am‐
       bient+inheritable sets would otherwise bestow capabilities on executed binaries.

       The **-q **flag is used to make the program less verbose in its output.

## EXIT CODE
       The  **setcap  **program will exit with a 0 exit code if successful. On failure, the exit code is
       1.

## REPORTING BUGS
       Please report bugs via:

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

## SEE ALSO
       [**capsh**(1)](https://www.chedong.com/phpMan.php/man/capsh/1/markdown), [**cap_from_text**(3)](https://www.chedong.com/phpMan.php/man/capfromtext/3/markdown), [**cap_get_file**(3)](https://www.chedong.com/phpMan.php/man/capgetfile/3/markdown), [**capabilities**(7)](https://www.chedong.com/phpMan.php/man/capabilities/7/markdown), [**user_namespaces**(7)](https://www.chedong.com/phpMan.php/man/usernamespaces/7/markdown), [**captree**(8)](https://www.chedong.com/phpMan.php/man/captree/8/markdown),
       [**getcap**(8)](https://www.chedong.com/phpMan.php/man/getcap/8/markdown) and [**getpcaps**(8)](https://www.chedong.com/phpMan.php/man/getpcaps/8/markdown).

                                             2020-08-29                                    [_SETCAP_(8)](https://www.chedong.com/phpMan.php/man/SETCAP/8/markdown)
