1setfilecon(3)             SE Linux API documentation             setfilecon(3)
2
3
4

NAME

6       setfilecon,  fsetfilecon, lsetfilecon - set SELinux security context of
7       a file
8
9

SYNOPSIS

11       #include <selinux/selinux.h>
12
13       int setfilecon(const char *path, security_context_t con);
14
15       int lsetfilecon(const char *path, security_context_t con);
16
17       int fsetfilecon(int fd, security_context_t con);
18
19

DESCRIPTION

21       setfilecon sets the security context of the file system object.
22
23       lsetfilecon is identical to setfilecon, except in the case  of  a  sym‐
24       bolic  link,  where  the link itself has it's context set, not the file
25       that it refers to.
26
27       fsetfilecon is identical to setfilecon, only the open file  pointed  to
28       by  filedes  (as  returned by open(2)) has it's context set in place of
29       path.
30
31

RETURN VALUE

33       On success, zero is returned. On failure, -1 is returned and  errno  is
34       set appropriately.
35
36       If  there  is  insufficient  space  remaining  to  store  the  extended
37       attribute, errno is set to either ENOSPC, or EDQUOT if  quota  enforce-
38       ment was the cause.
39
40       If extended attributes are not supported by the filesystem, or are dis-
41       abled, errno is set to ENOTSUP.
42
43       The errors documented for the stat(2) system call are  also  applicable
44       here.
45
46

SEE ALSO

48       selinux(3), freecon(3), getfilecon(3), setfscreatecon(3)
49
50
51
52russell@coker.com.au            1 January 2004                   setfilecon(3)
Impressum