Webサイトがファイルに書き込めないか、ディレクトリを作成できません。

Webサイトがファイルに書き込めないか、ディレクトリを作成できません。

私は約6ヶ月以上TeemIPをインストールしようとしましたが、Centos7ではこの問題を解決できませんでした。

私が得るエラーは次のとおりです。

  • "/var/www/teemp/public_html/web/log"ディレクトリが存在しますが、アプリケーションは書き込めません。

  • TeemIpに書き込み可能にするには、「/var/www/temip/public_html/web/env-product」ディレクトリが必要です。 '/var/www/teemp/public_html/web/env-product'ディレクトリは存在せず、 '/var/www/teemp/public_html/web/'に書き込めません。アプリケーションは 'env-product'ディレクトリを作成できません。 。

  • TeemIpに書き込み可能にするには、「/var/www/temip/public_html/web/env-products-build」ディレクトリが必要です。 '/var/www/teemp/public_html/web/env-product-build' ディレクトリが存在せず、 '/var/www/teemp/public_html/web/' に書き込めません。アプリケーションで「env-product-」ディレクトリを作成できません。 -Construct"で"ビルド"を実行します。

  • TeemIpに書き込み可能にするには、「/var/www/temip/public_html/web/conf」ディレクトリが必要です。アプリケーションは存在せず、 '/var/www/teemp/public_html/web/'に書き込めない '/var/www/teemp/public_html/web/conf'ディレクトリに 'conf'ディレクトリを作成できません。

  • '/var/www/teemp/public_html/web/data'ディレクトリが存在しますが、アプリケーションは書き込めません。

次の権限を使用して、Apache httpdのwww-dataというユーザーとグループを作成しました。

[root@TeemIP html]# ls -l
total 648     
drwxrwsr-x. 3 www-data www-data     24 Apr  7 21:24 addons
drwxrwsr-x. 3 www-data www-data   4096 Apr  7 21:24 application
-rwxrwxr-x. 1 www-data www-data    245 Apr  7 21:24 approot.inc.php
drwxrwsr-x. 3 www-data www-data   4096 Apr  7 21:24 core
drwxrwsr-x. 6 www-data www-data   4096 Apr  7 21:24 css
drwxrwsr-x. 2 www-data www-data     58 Apr  7 21:24 data
drwxrwsr-x. 3 www-data www-data     17 Apr  7 21:24 datamodels
drwxrwsr-x. 2 www-data www-data   4096 Apr  7 21:24 dictionaries
drwxrwsr-x. 2 www-data www-data     30 Apr  7 21:24 documentation
drwxrwsr-x. 2 www-data www-data     24 Apr  7 21:24 extensions
drwxrwsr-x. 4 www-data www-data   8192 Apr  7 21:24 images
-rwxrwxr-x. 1 www-data www-data   1030 Apr  7 21:24 index.php
drwxrwsr-x. 7 www-data www-data   4096 Apr  7 21:24 js
drwxrwsr-x. 7 www-data www-data     84 Apr  7 21:24 lib
drwxrwsr-x. 2 www-data www-data     58 Apr  7 21:24 log
-rwxrwxr-x. 1 www-data www-data 603311 Apr  7 21:24 manifest.xml
drwxrwsr-x. 2 www-data www-data   4096 Apr  7 21:24 pages
drwxrwsr-x. 3 www-data www-data     55 Apr  7 21:24 portal
drwxrwsr-x. 5 www-data www-data   4096 Apr  7 21:24 setup
drwxrwsr-x. 5 www-data www-data     73 Apr  7 21:24 sources
drwxrwsr-x. 2 www-data www-data    141 Apr  7 21:24 synchro
-rwxrwxr-x. 1 www-data www-data    630 Apr  7 21:24 web.config
drwxrwsr-x. 2 www-data www-data   4096 Apr  7 21:24 webservices

私が理解しているように、TeemIPアプリケーションはhttpデーモンを使用してログを作成し、ディレクトリを生成します。 httpd.conf ファイルには www-data ユーザーとグループが含まれており、次のように構成されます。

# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
Include conf.modules.d/*.conf

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group www-data

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. [email protected]
#
ServerAdmin root@localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify

私は試した: Apache2権限の問題

また、ユーザーとグループをsudoユーザーとグループに変更しようとしましたが、違いはありませんでした。 /var/wwwディレクトリの所有者をwww-dataに変更し、/var/wwwディレクトリの権限を775(繰り返し)に変更しました。また、Apacheデーモンのために特別にwww-dataユーザーとグループを作成しましたが、adduser usergroupadd group

追加情報が必要な場合はお知らせください。私はLinuxシステムの中級または専門家レベルの知識がないので、どこを見るべきかわかりません。

ベストアンサー1

SELinuxが存在する理由はあります。標準ファイルシステム権限以上のアクセス制限を適用して、サーバーをより安全にします。

あなたしなければならないSELinuxでこれを強制してみてください:-)

どのTeemIP Webディレクトリが読み取り専用で、どちらがApacheで書き込み可能であるかを確認する必要があります。だから使用説明書はhttps://wiki.centos.org/HowTos/SELinux(特にファイルラベルのリダイレクトに関するセクション[5.2])それに応じてディレクトリラベルをリダイレクトします。

通常、semanage fcontext -a -t httpd_sys_content_t "/<pathspec>(/.*)?"読み取り専用ディレクトリとsemanage fcontext -a -t httpd_sys_rw_content_t "/<pathspec>(/.*)?"書き込み可能ディレクトリに使用されます。その後、restorecon -RvWebルートで実行し、魔法が起こるのを見てください。

ausearch -ts recent -m avc -i許可モード()で実行したときなどのコマンドを使用すると、setenforce 0SELinux監査ログでアクセスの問題を確認できます。audit2why -aにリクエストを送信することもできますaudit2why

TeemIPが機能し、SELinux監査ログで新しいエントリがトリガーされない場合は、次の手順を実行する準備が整いましたsetenforce 1

頑張ってください!

おすすめ記事