Interview Prep/Linux/Permissions, ownership, SELinux and mounts

Files moved with `mv` from a home directory into `/var/www/html` give 403 errors, but files created there directly work.

IntermediateTroubleshootingPermissions, ownership, SELinux and mounts
Answer

Likely causes → mv keeps the original SELinux context (user_home_t); cp creates new files with the destination's context.

Diagnose →

ls -Z /var/www/html
matchpathcon /var/www/html/page.html

Fix → sudo restorecon -Rv /var/www/html.

Prevent → Deploy with cp, rsync or packages, or run restorecon as part of deployment.

All Linux questions Roadmap: Linux

More on Permissions, ownership, SELinux and mounts