setfiles


Description:

[ Version ( since = "1.57.1" ) ]
public bool setfiles (string specfile, string[] paths, Setfiles? optargs) throws Error

low level relabel parts of the filesystem

This invokes the SELinux setfiles command which is a low level tool used to relabel parts of the filesystem.

The specfile parameter controls the policy spec file used. You have to parse "/etc/selinux/config" to find the correct SELinux policy and then pass the spec file, usually: "/etc/selinux/" + *selinuxtype* + "/contexts/files/file_contexts".

The required paths parameter is the list of top level directories where relabelling starts. setfiles will only relabel up to filesystem boundaries so, for example, passing just "/" will relabel the whole root filesystem, but no other mounted filesystems. If the list is empty, setfiles is not called.

The optional force boolean controls whether the context is reset for customizable files, and also whether the user, role and range parts of the file context is changed.

This function depends on the feature "selinuxrelabel". See also feature_available.

Parameters:

this

A GuestfsSession object

paths

an array of strings

optargs

a GuestfsSetfiles containing optional arguments

Returns:

true on success, false on error