Chris PeBenito 473ea7
.TH "setfilecon" "3" "1 January 2004" "russell@coker.com.au" "SE Linux API documentation"
Chris PeBenito 473ea7
.SH "NAME"
Chris PeBenito 473ea7
setfilecon, fsetfilecon, lsetfilecon \- set SE Linux security context of a file
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "SYNOPSIS"
Chris PeBenito 473ea7
.B #include <selinux/selinux.h>
Chris PeBenito 473ea7
.sp
Chris PeBenito 473ea7
.BI "int setfilecon(const char *" path ", security_context_t "con );
Chris PeBenito 473ea7
.br 
Chris PeBenito 473ea7
.BI "int lsetfilecon(const char *" path ", security_context_t "con );
Chris PeBenito 473ea7
.br 
Chris PeBenito 473ea7
.BI "int fsetfilecon(int "fd ", security_context_t "con );
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "DESCRIPTION"
Chris PeBenito 473ea7
.B setfilecon
Chris PeBenito 473ea7
sets the security context of the file system object.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.B lsetfilecon
Chris PeBenito 473ea7
is identical to setfilecon, except in the case of a symbolic link, where the
Chris PeBenito 473ea7
link itself has it's context set, not the file that it refers to.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.B fsetfilecon
Chris PeBenito 473ea7
is identical to setfilecon, only the open file pointed to by filedes (as
Chris PeBenito 473ea7
returned by open(2)) has it's context set in place of path.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "RETURN VALUE"
Chris PeBenito 473ea7
On success, zero is returned. On failure, -1 is returned and errno is
Chris PeBenito 473ea7
set appropriately.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
If there is insufficient space remaining to store the extended
Chris PeBenito 473ea7
attribute, errno is set to either ENOSPC, or EDQUOT if quota enforce-
Chris PeBenito 473ea7
ment was the cause.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
If extended attributes are not supported by the filesystem, or are dis-
Chris PeBenito 473ea7
abled, errno is set to ENOTSUP.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
The errors documented for the stat(2) system call are also applicable
Chris PeBenito 473ea7
here.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "SEE ALSO"
Chris PeBenito 473ea7
.BR freecon "(3), " getfilecon "(3), " setfscreatecon "(3)"