I'm having some issues with permissions when it comes to symbolic links on my apache2 webserver. I originally had a data/ in /var/www , but was it getting too large for the directory and I kept getting a partition full warning. I'd like to move the data/ folder to /home/processor/Documents/sandbox/www_data/
I moved all the data to www_data and created a symbolic link in /var/www
ln -s /home/processor/Documents/sandbox/www_data data
Checking the link:
:/var/www$ ls -l data
lrwxrwxrwx 1 processor processor 43 Mar 16 17:03 data -> /home/processor/Documents/sandbox/www_data/
An example of the data shows that all permissions seem reasonable to me:
:/var/www$ ls -l data/2/15/2015/8/25/10/54/wf/2_15_2015_8_25_10_54_11*
-rwxrwxrwx 1 processor processor 475643 Mar 16 16:58 data/2/15/2015/8/25/10/54/wf/2_15_2015_8_25_10_54_11.png
-rwxrwxrwx 1 processor processor 53539 Mar 16 16:58 data/2/15/2015/8/25/10/54/wf/2_15_2015_8_25_10_54_11_thumb.png
This is whats in between the <VirtualHost *:80> </VirtualHost> in my /etc/apache2/sites-available/000-default.conf:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options FollowSymLinks Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
But when trying too access it from the site I get "Forbidden You don't have permission to access /data/2/15/2015/8/25/9/46/wf/2_15_2015_8_25_9_46_28.png on this server."
I've read through a bunch of threads and have chown www-data:www-data, I've chmod -R 777 everything, and changed my 000-default.conf to numerous varieties of the same thing, but nothing is working. I don't know where to go from here.
Any suggestions would be greatly appreciated.
Thanks
It has to do with the permissions of /home/processor. The entire path needs a certain degree of privileges and the home directory did not have them. The only thing that needed to be done was to allow access to read and execute
sudo chmod 755 /home/processor/
Related
Read almost all questions here, but no solution found. This drives me crazy already to do such simple stuff to run PHP on my localhost...
You don't have permission to access this resource.Server unable to
read htaccess file, denying access to be safe
ls -l
-rwxrwxrwx 1 user user 51 sep 27 14:42 .htaccess
ls -l
drwxrwxr-x 2 user user 4096 sep 27 15:17 www
Any help appreciated!
Check if there is an .htaccess file inside the www folder (and its permissions), since Apache looks for one at every directory up to the one where the requested file exists.
I'm coming from an Apache on Windows server background, but in regards to the .htaccess file, you can also put a "AllowOverride None" in your section of your httpd.conf file. At least in Windows, this means nothing can be overridden, therefore no need to look for .htaccess files.
You can also add a line to tell Apache that the "AccessFileName" is blank. Here are the entried I'm speaking of from my config file. I'm running a XAMPP server on Windows.
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
AccessFileName ""
Could I ask for some help with PHP and permissions on Linux. I'm trying to move log files from /var/www/html/log to /home/user/log and then created symbolic link to it. I have used command
ln -s /home/user/log/ log
to create the link and made sure to give permissions 755 (even 777) to both link and folder /home/user/log, as well as owner set to apache:apache on both. But I get permission denied all the time even if I try to just list the files over the symlink. Tried adding to httpd.conf below:
<Directory "/var/www">
Options Indexes FollowSymLinks
AllowOverride None
# Allow open access:
Require all granted
</Directory>
<Directory "/home/user/log">
Options Indexes FollowSymLinks
AllowOverride None
# Allow open access:
Require all granted
</Directory>
New folder location permissions
drwxrwxrwx. 3 apache apache 4.0K Feb 15 11:19 log
Symlink permissions
lrwxrwxrwx. 1 apache apache 17 Feb 15 12:57 log -> /home/user/log/
Error from php in chrome browser
Warning: scandir(/var/www/html/log): failed to open dir: Permission denied in /var/www/html/test.php on line 2
test.php code
<?php
$files = scandir('/var/www/html/log');
echo '<pre>';
print_r($files);
echo '</pre>';
?>
Output of ls -ld /home/user /home/user/log
drwxrwxrwx. 28 user user 4096 Feb 15 11:18 /home/user
drwxrwxrwx. 3 apache apache 4096 Feb 15 12:57 /home/user/log
What am I missing??
Thank you
I have a very strange permission problem with my Apache. Let's me explain what happened. We bought AWS EC2 instance and installed there AMI Centos 7 with Webmin image. Our Root path is /home/centos/public_html but unfortunately, we got information on the web 'You don't have permission to access / on this server'. Of course, I change access to the folder and all files, even on 777 and owner 'centos' user. Apache user is part of centos group. When I checked log file I got
[core:error] [pid 3872] (13)Permission denied: [client X.X.X.X:60088] AH00035:
access to / denied (filesystem path '/home/centos/public_html')
because search permissions are missing on a component of the path
On the public_html folder, we have default index.php to show us configuration of PHP and is not working.
<?php
phpinfo();
?>
Our http.conf looks like that:
User apache
Group apache
<VirtualHost *:80>
DocumentRoot /home/centos/public_html
ServerName our_domain
ServerAlias *.our_domain
<Directory /home/centos/public_html>
Options Indexes FollowSymLinks
DirectoryIndex index.php index.html welcome.php
allow from all
AllowOverride All
Require all granted
AddType application/x-httpd-php .php
</Directory>
</VirtualHost>
Following this suggestion Apache - Permissions are missing on a component of the path
I had run command:
sudo chcon -R --type=httpd_sys_rw_content_t /home/centos/public_html/
and nothing, any ideas, thank you in advance for any suggestions.
I have a symlink mysite in my /srv/http/ folder pointing to /home/some-user/somefolder.
In my /etc/httpd/conf/httpd.conf, according to many thread in this site and other forums all around the Internet, I set the following:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
DocumentRoot "/srv/http"
<Directory "/srv/http">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Then I changed permission to 777 recursively to my symlink target folder like this:
chmod 777 -R /home/some-user/some-folder
But if I open my webbrowser and enter http://localhost/mysite/mypage.php I get the following error:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.9 (Unix) PHP/5.5.14
I've read many articles saying to do so, but I still can get it working...
You should chmod o+x the entire path where apache'd go through.
So in your case:
sudo chmod o+x /home/
sudo chmod o+x /home/some-user/
sudo chmod o+x /home/some-user/somefolder
Ok, found out! I needed also chmod o+x /home/some-user (parent folder to my site folder)
I have Ubuntu 11.10 with Lamp installed
There is some files that i can't access to from my web directory "/var/www"
http://localhost/banner/banner.html
I am getting an error :
Forbidden You don't have permission to access /banner/banner.html on this server.
Apache/2.2.20 (Ubuntu) Server at localhost Port 80
I can access /var/www/index.php normally as i can browse /var/www/banner normally too from my browser
This is a small peace of :
a1a4a#A1A4a:~$ ls -l /var/www
total 7088
-rwxrwxrwx 1 root root 916 2011-11-25 20:49 access-controlled.php
-rw-r--r-- 1 root root 22163 2011-12-16 22:28 account_info.php
-rw-r--r-- 1 root root 22126 2011-12-16 22:27 account_info.php~
-rw-r--r-- 1 root root 16585 2011-12-16 21:32 acount_info.php
-rw-r--r-- 1 root root 0 2011-12-16 21:28 acount_info.php~
drwxrwxrwx 5 root root 4096 2011-12-09 23:03 banner
drwxrwxrwx 2 root root 4096 2011-12-09 23:03 css
And
a1a4a#A1A4a:~$ ls -l /var/www/banner
total 20
-rw--w---- 1 root root 2564 2011-11-25 20:51 banner.html
drwx-w---- 4 root root 4096 2011-12-09 23:03 examples
drwx-w---- 2 root root 4096 2011-12-09 23:03 lib
drwx-w---- 4 root root 4096 2011-12-09 23:03 skins
-rw--w---- 1 root root 1431 2011-11-25 20:51 style.css
This is my config :
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
My "nano /etc/apache2/apache2.conf" is set as default ...
How can i make all my /var/www files (folders and sub-folders and files ) accessible from my browser as if i was on a windows machine using Wamp ...
P.S: I will host the website on a Windows machine i am using ubuntu just for coding.
the user running the apache deamon, on ubuntu thats www-data (like in most debian based systems), needs at least read permissions for the files.
But as you posted only owner root and group root has read rights.
Actually owner root has rw group root has r.
So the user actually running the webserver (www-data) falls to the others permissions, which have none.
Either do a chmod -R o+r /var/www/banner/* or a chown -R www-data /var/www/banner to fix that.
I always forget that while the sub-directories and files need the read permission, the sub-directories also need execute permission.
chmod a+x banner
This tends to come up when I've saved a web page in the 'Webpage, Complete' format with Chrome or Firefox and am then trying to serve it under localhost, which I often do when building mockups for clients.
May be it is an issue with your banner.html permissions - apache`s user has no permissions even to read it.