semanage fcontext -a -t home_root_t "/disk6"
- This command directly assigns the type
home_root_t
to /disk6 - Only applies this specific type label
- Any subdirectories/files created under /disk6 will inherit based on standard SELinux transition rules, but won’t automatically mirror /home’s complete labeling pattern
semanage fcontext -a -e /home /disk6/
- This command creates an equivalency rule saying “/disk6 should be treated exactly like /home”
- Creates a complete context clone or mirror of /home
- All subdirectories and files created under /disk6 will get the same SELinux contexts as their equivalent paths under /home
- Inherits the complete labeling pattern and transitions that /home has
The second approach (-e
) is generally preferred when you want to create an alternative home directory structure because:
- It automatically handles all the various context types used in a home directory structure
- Maintains consistency with how /home is labeled
- Requires less manual configuration since it copies the entire context pattern
- Better preserves SELinux’s security model for home directories
The first approach is more limited since it only sets a single type and would require additional rules to fully replicate home directory behavior.
To make either change take effect, you’d still need to run restorecon -R /disk6
afterwards.