man-pages/man3/setfilecon.3.html
2021-03-31 01:06:50 +01:00

122 lines
3.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of setfilecon</TITLE>
</HEAD><BODY>
<H1>setfilecon</H1>
Section: SELinux API documentation (3)<BR>Updated: 1 January 2004<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
setfilecon, fsetfilecon, lsetfilecon - set SELinux security context of a file
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/selinux/selinux.h">selinux/selinux.h</A>&gt;</B>
<P>
<B>int setfilecon(const char *</B><I>path</I><B>, char *</B><I>con</I><B>);</B>
<P>
<B>int setfilecon_raw(const char *</B><I>path</I><B>, char *</B><I>con</I><B>);</B>
<P>
<B>int lsetfilecon(const char *</B><I>path</I><B>, char *</B><I>con</I><B>);</B>
<P>
<B>int lsetfilecon_raw(const char *</B><I>path</I><B>, char *</B><I>con</I><B>);</B>
<P>
<B>int fsetfilecon(int fd</B><I>, char *</I><B>con</B><I>);</I>
<P>
<B>int fsetfilecon_raw(int fd</B><I>, char *</I><B>con</B><I>);</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>setfilecon</B>()
sets the security context of the file system object.
<P>
<B>lsetfilecon</B>()
is identical to setfilecon, except in the case of a symbolic link, where the
link itself has it's context set, not the file that it refers to.
<P>
<B>fsetfilecon</B>()
is identical to setfilecon, only the open file pointed to by filedes (as
returned by
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2))
has it's context set in place of path.
<P>
<B>setfilecon_raw</B>(),
<B>lsetfilecon_raw</B>(),
and
<B>fsetfilecon_raw</B>()
behave identically to their non-raw counterparts but do not perform context
translation.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, zero is returned. On failure, -1 is returned and
<I>errno</I>
is set appropriately.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
If there is insufficient space remaining to store the extended
attribute,
<I>errno</I>
is set to either
<B>ENOSPC</B>,
or
<B>EDQUOT</B>
if quota enforcement was the cause.
<P>
If extended attributes are not supported by the filesystem, or are disabled,
<I>errno</I>
is set to
<B>ENOTSUP</B>.
<P>
The errors documented for the
<B><A HREF="/cgi-bin/man/man2html?2+stat">stat</A></B>(2)
system call are also applicable here.
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+selinux">selinux</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+getfilecon">getfilecon</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+setfscreatecon">setfscreatecon</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="5"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="6"><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:56 GMT, March 31, 2021
</BODY>
</HTML>