2016-10-19 6 views
0

ich Setup eine centos7 in VirtualBox, in denen Apache läuft, MariaDB, phpMyAdmin etc, Gastgeber ist macosApache Karte URL virtualbox Freigabeordner

wenn ich versuche, eine URL zu einem gemeinsam genutzten Ordner auf der Karte, I der Fehler aufgetreten

Forbidden: You don't have permission to access /tutorial/ on this server. 

sudo tail -f/var/log/httpd/error_log

[Wed Oct 19 22:48:23.108758 2016] [autoindex:error] [pid 1469] (13)Permission denied: [client 192.168.144.1:51847] AH01275: Can't open directory for index: /php-tutorial/www/ 

/etc/httpd/conf.d/tutorial.conf

Alias /tutorial "/php-tutorial/www" 

<Directory "/php-tutorial/www"> 
    Options Indexes FollowSymLinks 
    AllowOverride None 
    Require all granted 
</Directory> 

Ordnerberechtigungen sind

drwxr-xr-x. 1 vagrant vagrant system_u:object_r:vmblock_t:s0 /php-tutorial/www 
drwxr-xr-x. 1 vagrant vagrant system_u:object_r:vmblock_t:s0 /php-tutorial 
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www 
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html 

Ich bin nicht sicher, ob dies möglich ist, und, wenn möglich, was die richtige Art und Weise zu konfigurieren ist.

Antwort

0

Dank für ezra-s für die Hervorhebung das mögliche Problem zu überprüfen.

Ja, es liegt an SELinux, weil SELinux standardmäßig in Centos 7.2 aktiviert ist. Dies ist das hier verwendete Gastbetriebssystem.

Es gibt zwei verschiedene Lösungen für dieses Problem:

  1. Schnell Lösung Deaktivieren Sie SELinux

    # vi /etc/selinux/config 
    
    SELINUX=enforcing # <= change enforcing to disabled 
    
  2. bessere Lösung, fertigen SELinux-Richtlinien

    # yum install -y policycoreutils-python 
    # vi httpd_t.te 
    
    module httpd_t 1.0; 
    
    require { 
         type httpd_t; 
         type vmblock_t; 
         class file { read getattr open }; 
    } 
    
    #============= httpd_t ============== 
    allow httpd_t vmblock_t:file { read getattr open }; 
    
    # checkmodule -M -m -o httpd_t.mod httpd_t.te 
    # semodule_package -o httpd_t.pp -m httpd_t.mod 
    # semodule -i httpd_t.pp 
    # systemctl restart httpd 
    

Referenzen:

  1. https://github.com/mitchellh/vagrant/issues/6970, stieß jemand auf das gleiche Problem und fand den Ausweg Schritt für Schritt.
  2. https://wiki.centos.org/HowTos/SELinux, eine gute Einführung über SELinux.
0

Sie scheinen SELinux zu haben, die SELinux-Protokolle