{"id":1038,"date":"2019-07-24T10:45:45","date_gmt":"2019-07-24T06:45:45","guid":{"rendered":"http:\/\/blog.5flor.ru\/?p=1038"},"modified":"2019-07-24T10:45:45","modified_gmt":"2019-07-24T06:45:45","slug":"se-linux-%d0%bf%d0%be%d1%81%d1%82%d0%be%d1%8f%d0%bd%d0%bd%d1%8b%d0%b5-%d0%b8%d0%b7%d0%bc%d0%b5%d0%bd%d0%b5%d0%bd%d0%b8%d1%8f-semanage-fcontext","status":"publish","type":"post","link":"https:\/\/blog.5flor.ru\/?p=1038","title":{"rendered":"SE linux \u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f: semanage fcontext"},"content":{"rendered":"\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/usr\/sbin\/semanage fcontext<\/code>&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 SELinux \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 targeted, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b&nbsp;<code>\/etc\/selinux\/targeted\/contexts\/files\/file_contexts<\/code>, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b&nbsp;<code>file_contexts<\/code>, \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f\u0432 \u0444\u0430\u0439\u043b&nbsp;<code>file_contexts.local<\/code>&nbsp;\u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;<code>\/web\/<\/code>.&nbsp;<code>setfiles<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0430\u044f\u0441\u044f \u043f\u0440\u0438 \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438&nbsp;<code>\/sbin\/restorecon<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0430\u044f\u0441\u044f \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 SELinux \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0447\u0438\u0442\u0430\u044e\u0442 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439&nbsp;<code>\/usr\/sbin\/semanage fcontext<\/code>&nbsp;\u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430. \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 SELinux \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u0435<\/h5>\n\n\n\n<p>\u0414\u043b\u044f \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 SELinux \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -a <em><code>options<\/code><\/em> <em><code>file-name<\/code><\/em>|<em><code>directory-name<\/code><\/em><\/code>, \u043f\u043e\u043c\u043d\u044f, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c.<\/li><li>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/sbin\/restorecon -v <em><code>file-name<\/code><\/em>|<em><code>directory-name<\/code><\/em><\/code>&nbsp;\u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0444\u0430\u0439\u043b\u0430<\/h5>\n\n\n\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u0444\u0430\u0439\u043b\u0430 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 SELinux:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>touch \/etc\/file1<\/code>&nbsp;\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435&nbsp;<code>\/etc\/<\/code>&nbsp;\u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0438\u043f\u043e\u043c&nbsp;<code>etc_t<\/code>:# ls -Z \/etc\/file1\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:etc_t:s0       \/etc\/file1\n<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t samba_share_t \/etc\/file1<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0444\u0430\u0439\u043b\u0430&nbsp;<code>file1<\/code>&nbsp;\u043d\u0430&nbsp;<code>samba_share_t<\/code>. \u041e\u043f\u0446\u0438\u044f&nbsp;<code>-a<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u0430 \u043e\u043f\u0446\u0438\u044f&nbsp;<code>-t<\/code>&nbsp;\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f (<code>samba_share_t<\/code>). \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e &#8212;&nbsp;<code>file1<\/code>&nbsp;\u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0442\u0438\u043f\u043e\u043c&nbsp;<code>etc_t<\/code>:# \/usr\/sbin\/semanage fcontext -a -t samba_share_t \/etc\/file1\n# ls -Z \/etc\/file1\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:etc_t:s0       \/etc\/file1\n\u041a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t samba_share_t \/etc\/file1<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432&nbsp;<code>\/etc\/selinux\/targeted\/contexts\/files\/file_contexts.local<\/code>:\/etc\/file1    unconfined_u:object_r:samba_share_t:s0\n<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/sbin\/restorecon -v \/etc\/file1<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>semanage<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432&nbsp;<code>file.contexts.local<\/code>&nbsp;\u0434\u043b\u044f&nbsp;<code>\/etc\/file1<\/code>, \u043a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/sbin\/restorecon<\/code>&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430&nbsp;<code>samba_share_t<\/code>:# \/sbin\/restorecon -v \/etc\/file1\nrestorecon reset \/etc\/file1 context unconfined_u:object_r:etc_t:s0-&gt;system_u:object_r:samba_share_t:s0\n<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>rm -i \/etc\/file1<\/code>&nbsp;\u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f&nbsp;<code>file1<\/code>.<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -d \/etc\/file1<\/code>&nbsp;\u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f&nbsp;<code>\/etc\/file1<\/code>. \u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0443\u0434\u0430\u043b\u0435\u043d, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b&nbsp;<code>restorecon<\/code>&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430&nbsp;<code>etc_t<\/code>, \u0432\u043c\u0435\u0441\u0442\u043e&nbsp;<code>samba_share_t<\/code>.<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430<\/h5>\n\n\n\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0430 \u0442\u0438\u043f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 Apache HTTP Server:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>mkdir \/web<\/code>&nbsp;\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u042d\u0442\u043e\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0442\u0438\u043f\u043e\u043c&nbsp;<code>default_t<\/code>:# ls -dZ \/web\ndrwxr-xr-x  root root unconfined_u:object_r:default_t:s0 \/web\n\u041a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>ls<\/code>&nbsp;<code>-d<\/code>&nbsp;\u0441 \u043e\u043f\u0446\u0438\u0435\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435, \u0430 \u043d\u0435 \u043e \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c, \u0430 \u043e\u043f\u0446\u0438\u044f&nbsp;<code>-Z<\/code>&nbsp;\u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 SELinux (\u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435,&nbsp;<code>unconfined_u:object_r:default_t:s0<\/code>).<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t httpd_sys_content_t \/web<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;<code>\/web\/<\/code>&nbsp;\u043d\u0430&nbsp;<code>httpd_sys_content_t<\/code>. \u041e\u043f\u0446\u0438\u044f&nbsp;<code>-a<\/code>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u0430 \u043e\u043f\u0446\u0438\u044f&nbsp;<code>-t<\/code>&nbsp;\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f (<code>httpd_sys_content_t<\/code>). \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e &#8212;&nbsp;<code>\/web\/<\/code>&nbsp;\u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0442\u0438\u043f\u043e\u043c&nbsp;<code>default_t<\/code>:# \/usr\/sbin\/semanage fcontext -a -t httpd_sys_content_t \/web\n# ls -dZ \/web\ndrwxr-xr-x  root root unconfined_u:object_r:default_t:s0   \/web\n\u041a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t httpd_sys_content_t \/web<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432&nbsp;<code>\/etc\/selinux\/targeted\/contexts\/files\/file_contexts.local<\/code>:\/web    unconfined_u:object_r:httpd_sys_content_t:s0\n<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/sbin\/restorecon -v \/web<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b&nbsp;<code>semanage<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432&nbsp;<code>file.contexts.local<\/code>&nbsp;\u0434\u043b\u044f&nbsp;<code>\/web<\/code>, \u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/sbin\/restorecon<\/code>&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430&nbsp;<code>httpd_sys_content_t<\/code>:# \/sbin\/restorecon -v \/web\nrestorecon reset \/web context unconfined_u:object_r:default_t:s0-&gt;system_u:object_r:httpd_sys_content_t:s0\n\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0442\u0438\u043f SELinux \u043e\u0442 \u0441\u0432\u043e\u0438\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 SELinux, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f&nbsp;<code>\/web\/<\/code>, \u0444\u0430\u0439\u043b\u044b \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435&nbsp;<code>\/web\/<\/code>&nbsp;\u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0442\u0438\u043f\u043e\u043c&nbsp;<code>httpd_sys_content_t<\/code>.<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -d \/web<\/code>&nbsp;\u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f&nbsp;<code>\/web\/<\/code>.<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/sbin\/restorecon -v \/web<\/code>&nbsp;\u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 SELinux \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0438 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e<\/h5>\n\n\n\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 (\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c) \u043d\u0430 \u0442\u0438\u043f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c Apache HTTP Server. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430, \u0435\u0441\u043b\u0438 Apache HTTP Server \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 (\u0432\u043c\u0435\u0441\u0442\u043e&nbsp;<code>\/var\/www\/html\/<\/code>):<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>mkdir \/web<\/code>&nbsp;\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>touch \/web\/file{1,2,3}<\/code>&nbsp;\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0440\u0451\u0445 \u043f\u0443\u0441\u0442\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 (<code>file1<\/code>,&nbsp;<code>file2<\/code>&nbsp;\u0438&nbsp;<code>file3<\/code>). \u041a\u0430\u0442\u0430\u043b\u043e\u0433&nbsp;<code>\/web\/<\/code>&nbsp;\u0438 \u0444\u0430\u0439\u043b\u044b \u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a \u0442\u0438\u043f&nbsp;<code>default_t<\/code>:# ls -dZ \/web\ndrwxr-xr-x  root root unconfined_u:object_r:default_t:s0 \/web\n# ls -lZ \/web\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:default_t:s0 file1\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:default_t:s0 file2\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:default_t:s0 file3\n<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t httpd_sys_content_t \"\/web(\/.*)?\"<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;<code>\/web\/<\/code>&nbsp;\u0438 \u0444\u0430\u0439\u043b\u0430 \u0432 \u043d\u0435\u043c, \u043d\u0430&nbsp;<code>httpd_sys_content_t<\/code>. \u041e\u043f\u0446\u0438\u044f&nbsp;<code>-a<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u0430 \u043e\u043f\u0446\u0438\u044f&nbsp;<code>-t<\/code>&nbsp;\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f (httpd_sys_content_t). \u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435&nbsp;<code>\"\/web(\/.*)?\"<\/code>&nbsp;\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b&nbsp;<code>semanage<\/code>&nbsp;\u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443&nbsp;<code>\/web\/<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b\u0430\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e &#8212;&nbsp;<code>\/web\/<\/code>&nbsp;\u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0442\u0438\u043f\u043e\u043c&nbsp;<code>default_t<\/code>:# ls -dZ \/web\ndrwxr-xr-x  root root unconfined_u:object_r:default_t:s0 \/web\n# ls -lZ \/web\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:default_t:s0 file1\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:default_t:s0 file2\n-rw-r&#8212;r&#8212;  root root unconfined_u:object_r:default_t:s0 file3\n\u041a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t httpd_sys_content_t \"\/web(\/.*)?\"<\/code>&nbsp;\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432&nbsp;<code>\/etc\/selinux\/targeted\/contexts\/files\/file_contexts.local<\/code>:\/web(\/.*)?    system_u:object_r:httpd_sys_content_t:s0\n<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/sbin\/restorecon -R -v \/web<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;<code>\/web\/<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b\u0430\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e. \u041e\u043f\u0446\u0438\u044f&nbsp;<code>-R<\/code>&nbsp;\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044e, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0432\u043d\u0443\u0442\u0440\u0438&nbsp;<code>\/web\/<\/code>&nbsp;\u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0442\u0438\u043f\u043e\u043c&nbsp;<code>httpd_sys_content_t<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b&nbsp;<code>semanage<\/code>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u0432&nbsp;<code>file.contexts.local<\/code>&nbsp;\u0434\u043b\u044f&nbsp;<code>\/web(\/.*)?<\/code>, \u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;<code>\/sbin\/restorecon<\/code>&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0438\u043f \u043d\u0430&nbsp;<code>httpd_sys_content_t<\/code>:# \/sbin\/restorecon -R -v \/web\nrestorecon reset \/web context unconfined_u:object_r:default_t:s0-&gt;system_u:object_r:httpd_sys_content_t:s0\nrestorecon reset \/web\/file2 context unconfined_u:object_r:default_t:s0-&gt;system_u:object_r:httpd_sys_content_t:s0\nrestorecon reset \/web\/file3 context unconfined_u:object_r:default_t:s0-&gt;system_u:object_r:httpd_sys_content_t:s0\nrestorecon reset \/web\/file1 context unconfined_u:object_r:default_t:s0-&gt;system_u:object_r:httpd_sys_content_t:s0\n\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0442\u0438\u043f SELinux \u043e\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0444\u0430\u0439\u043b\u044b \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435&nbsp;<code>\/web\/<\/code>&nbsp;\u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0442\u0438\u043f\u043e\u043c&nbsp;<code>httpd_sys_content_t<\/code>.<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -d \"\/web(\/.*)?\"<\/code>&nbsp;\u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f&nbsp;<code>\"\/web(\/.*)?\"<\/code>.<\/li><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/sbin\/restorecon -R -v \/web<\/code>&nbsp;\u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 SELinux \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430<\/h5>\n\n\n\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 SELinux:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -a -t httpd_sys_content_t \/test<\/code>. \u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;<code>\/test\/<\/code>&nbsp;\u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432&nbsp;<code>\/etc\/selinux\/targeted\/contexts\/files\/file_contexts.local<\/code>:\/test    system_u:object_r:httpd_sys_content_t:s0\n<\/li><li>\u0414\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u043a\u043e\u043c\u0430\u043d\u0434\u0443&nbsp;<code>\/usr\/sbin\/semanage fcontext -d <em><code>file-name<\/code><\/em>|<em><code>directory-name<\/code><\/em><\/code>, \u0433\u0434\u0435&nbsp;<em><code>file-name<\/code><\/em>|<em><code>directory-name<\/code><\/em>&nbsp;\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0432&nbsp;<code>file_contexts.local<\/code>. \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432&nbsp;<code>file_contexts.local<\/code>:\/test    system_u:object_r:httpd_sys_content_t:s0\n\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d&nbsp;<code>\/test<\/code>. \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;<code>\/test\/<\/code>&nbsp;\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c&nbsp;<code>httpd_sys_content_t<\/code>&nbsp;\u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430&nbsp;<code>\/sbin\/restorecon<\/code>, \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437&nbsp;<code>file_contexts.local<\/code>:<code>\/usr\/sbin\/semanage fcontext -d \/test<\/code><\/li><\/ol>\n\n\n\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440&nbsp;<code>\/web(\/.*)?<\/code>, \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438:<code>\/usr\/sbin\/semanage fcontext -d \"\/web(\/.*)?\"<\/code>Refer to the&nbsp;semanage(8)&nbsp;manual page for further information about&nbsp;<code>\/usr\/sbin\/semanage<\/code>.\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430&nbsp;\/usr\/sbin\/semanage fcontext&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 SELinux \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 targeted, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b&nbsp;\/etc\/selinux\/targeted\/contexts\/files\/file_contexts, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b&nbsp;file_contexts, \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f\u0432 \u0444\u0430\u0439\u043b&nbsp;file_contexts.local&nbsp;\u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430&nbsp;\/web\/.&nbsp;setfiles, &hellip; <a href=\"https:\/\/blog.5flor.ru\/?p=1038\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,9],"tags":[],"class_list":["post-1038","post","type-post","status-publish","format-standard","hentry","category-1","category-9"],"_links":{"self":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/1038"}],"collection":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1038"}],"version-history":[{"count":0,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/1038\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}