An administrator needs to modify the file context type for a custom directory, /data/webapp, to match the type used by web content in an SELinux environment. Which command should they use to achieve this, ensuring the default policy is maintained for consistency?
The command semanage fcontext -a -t httpd_sys_content_t '/data/webapp(/.*)?' is correct because it uses the semanage fcontext command, which is responsible for managing file context types within SELinux policy. The -a flag is used to add a file specification, -t specifies the type, and the file path given indicates that the policy change should apply to the /data/webapp directory and all files within. This command ensures that the custom directory has the correct context for serving web content securely according to SELinux policies.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is SELinux and why is it important?
Open an interactive chat with Bash
What does the command 'semanage fcontext' do in SELinux?
Open an interactive chat with Bash
What is the difference between 'chcon' and 'semanage'?