Apache2 Forbidden Access - apache

I have tried a number of suggestions/answers for similar problems but none have helped!
I am running an Apache2..4.7 on ubuntu 14.4, I've done
mkdir /var/www/html/download
cp src /var/www/html/download/file.extn
While the request localhost or 127.0.0.1 and surprisingly 127.0.1.1 are returning Ubuntu default page,
http://127.0.0.1/download/file.extn is giving
Forbidden
You don't have permission to access /download/file.extn on this server.
Apache/2.4.7 (Ubuntu) Server at 127.0.0.1 Port 80
Error log says:
(13)Permission denied: [client 127.0.0.1:52345] AH00035: access to /download/apkFile.apk denied (filesystem path '/var/www') because search permissions are missing on a component of the path
apache2.conf has been changed to:
Directory
Options FollowSymLinks
AllowOverride None
Require all granted
Directory
Directory /usr/share
AllowOverride None
Require all granted
Directory
Directory /var/www/
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Directory
Directory /var/www/html/download
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Directory
Permission to all directories leading to /var/www/html/download/file.extn has been chmod to 644.

Related

403 you do not have permission

Im setting up a localhost for the first time. I have something weird going on.
I running Fedora 24 with apache with the root folder at /var/www/html.
I have tested that this works by using vi to create an index.html which loads fine.
But now I have written some html and php files and moved them to the root dir.
Imediately I get 403 message. Log writes Out this:
[Tue Apr 04 16:06:52.116376 2017] [core:error] [pid 15260] (13)Permission denied: [client ::1:40686] AH00132: file permissions deny server access: /var/www/html/index.html
Now I create a test.html with sudo vi test.html and this file is able to load without a 403.
I then matched all the ownership and permissions to the file that loaded correctly.
And still nothing.
in the config file This stands out:
<Directory "/var/www">
AllowOverride None
Allow open access:
Require all granted
</Directory>
and:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Am i missing somthing here?

Access forbidden

im installing xampp on elementary os, but i have a problem. When i am accessing to one of htdocs folders, i get 403 error.
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
Error 403
localhost
Apache/2.4.17 (Unix) OpenSSL/1.0.1p PHP/5.5.30 mod_perl/2.0.8-dev Perl/v5.16.3
I have tried editing my httpd.conf file, but that didnt worked.
Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"
<Directory "/opt/lampp/apache2/htdocs">
Require all denied
Order allow,deny
Allow from all
</Directory>
<Directory "/opt/lampp/apache2/htdocs/cup">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Thanks.
Have you tried chmoding the file/directory in question?
chmod a+r <filename>

Authorization failure (no authenticated user) - .htaccess error, Apache

I'm running Apache/2.4.7 (Ubuntu) Server and I'm trying to protect one of the directories 'myFolder' which is located at /var/www/html/myFolder
I made the following edits in /etc/apache2/apache2.conf file
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/html/myFolder>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I created .htaccess in /var/www/myFolder with the following contents
AuthUserFile /var/www/html/myFolder/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user
Also created htpasswd by
htpasswd -c /var/www/html/myFolder/.htpasswd admin
which then prompts for password.
I then try to access the file on the browser www.mydoman.com/myFolder/hello.html and it prompts for username and password. However, the authentication does not go through.
Here is the error from the error.log file
[authz_core:error] [pid 30042] [client xxx.xxx.xx.xxx:53348] AH01629: authorization failure (no authenticated user): /myFolder/hello.html
How can I resolve this issue?
A loaded mod-shib2 can cause this problem. According to this bug comment, setting ShibCompatValidUser On solves it.
Require valid-user does also work with mod_shib enabled. According to https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig this is only necessary for shib versions 2.5.2 and above. Note that ShibCompatValidUser is a server / virtual host option.

403 Forbidden You don't have permission to access /folder-name/ on this server

I was looking for an answer to my problem, but I could'nt find any answer which solves my case.
The problem is that I can't access the app folders in my var/www/ folder. When I go to localhost/ i get the message that my server is running and I have access to phpmyadmin too. But when I go to any localhost/folder-name i get the 403 error:
Forbidden
You don't have permission to access /folder-name/ on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
How can I solve it? Btw I'm using Ubuntu 13.04, and thanks for your answers. :)
Solved the problem with:
sudo chown -R $USER:$USER /var/www/folder-name
sudo chmod -R 755 /var/www
Grant permissions
under etc/apache2/apache2.conf, you can find one or more blocks that describe the server directories and permissions
As an example, this is the default configuration
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
you can replicate this but change the directory path /var/www/ with the new directory.
Finally, you need to restart the apache server, you can do that from a terminal with the command: sudo service apache2 restart
if permission issue and you have ssh access in root folder
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
will resolve your error
**403 Forbidden **
You don't have permission to access /Folder-Name/ on this server**
The solution for this problem is:
1.go to etc/apache2/apache2.conf
2.find the below code and change AllowOverride all to AllowOverride none
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride all Change this to---> AllowOverride none
Require all granted
</Directory>
It will work fine on your Ubuntu server
Solved issue using below steps :
1) edit file "/etc/apache2/sites-enabled/000-default.conf"
DocumentRoot "dir_name"
ServerName <server_IP>
<Directory "dir_name">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory "dir_name">
AllowOverride None
# Allow open access:
Require all granted
2) change folder permission
sudo chmod -R 777 "dir_name"

mercurial + Apache gives 403 error

I have setup my repo at /home/adil/hg/sample-repo and want to serve it via httpd. I am following the tutorial at https://www.mercurial-scm.org/wiki/PublishingRepositories#multiple and have created the hgweb.config file and have copied hgweb.cgi (renamed it to index.cgi) to /home/adil/web/mercurial/
My apache config (/etc/httpd/conf/httpd.conf) looks like this :
ScriptAlias /hg "/home/adil/web/mercurial/index.cgi"
<Directory "/home/adil/web/mercurial">
Order allow,deny
Allow from all
AllowOverride All
Options ExecCGI
AddHandler cgi-script .cgi
</Directory>
index.cgi, hgweb.config and all the dirs upwards have world read permissions
http://localhost/hg gives a "403 Forbidden" error. WTF?
PS: Apache error log shows :
[Sun Oct 17 06:45:38 2010] [error] [client 1.2.3.4] (13)Permission denied: access to /hg denied
I'm not an Apache config expert by any means, but I was experiencing this error and managed to get rid of it.
Before I did, I was getting this error in my error_log: client denied by server configuration: /Users/svn/Public/hg/hgwebdir.cgi
This was my original config:
ScriptAlias /hg "/Users/svn/Public/hg/hgwebdir.cgi"
<Location /hg>
AuthType Basic
AuthName "Mercurial Repositories"
AuthUserFile /Users/svn/Public/hg/auth
Require valid-user
</Location>
I added some options:
ScriptAlias /hg "/Users/svn/Public/hg/hgwebdir.cgi"
<Location /hg>
Options ExecCGI FollowSymLinks
Options None
Order allow,deny
Allow from all
AuthType Basic
AuthName "Mercurial Repositories"
AuthUserFile /Users/svn/Public/hg/auth
Require valid-user
</Location>
I tried Pablo's version too - one problem I experienced was that "ScriptAliasMatch ^/hg(.*)" was capturing the hg logo and stylesheets needed to render the browser repo explorer. I'm not sure if this even applies to hgweb.cgi because I don't use that one, but it was definitely an issue while using hgwebdir.cgi. Specifically: script not found or unable to stat: /Users/svn/Public/hg/hgweb.cgilogo.png
Probably Apache's process owner does not have permissions to access /home/adil/web/mercurial.
Also, do check Apache's error log (usually located in /var/log/httpd-error.log or some place similar. It will give you extra information to debug your installation.
To check what's the user running Apache's process do:
$ ps aux | grep http
ps should show what's the user running Apache.
Also, in case it helps, here's the way I do it:
ScriptAliasMatch ^/hg(.*) /usr/local/share/mercurial/www/hgweb.cgi$1
<Directory /usr/local/share/mercurial/www>
Options ExecCGI FollowSymLinks
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>