file_t
type. If it is desirable to use a different default context, mount the file system with the defcontext
option.
/dev/sda2
) to the newly-created /test/
directory. It assumes that there are no rules in /etc/selinux/targeted/contexts/files/
that define a context for the /test/
directory:
# mount /dev/sda2 /test/ -o defcontext="system_u:object_r:samba_share_t:s0"
defcontext
option defines that system_u:object_r:samba_share_t:s0
is "the default security context for unlabeled files"[10].
/test/
) of the file system is treated as if it is labeled with the context specified by defcontext
(this label is not stored on disk). This affects the labeling for files created under /test/
: new files inherit the samba_share_t
type, and these labels are stored on disk.
/test/
while the file system was mounted with a defcontext
option retain their labels.
[10] Morris, James. "Filesystem Labeling in SELinux". Published 1 October 2004. Accessed 14 October 2008: http://www.linuxjournal.com/article/7426.