A requested privilege is not held by client (Apache2 + WebDAV) - php

This is driving me crazy. I have a Apache2 server with WebDAV enabled on my Debian Wheezy server. I can access it and read from it and it appears to be running correctly.
From my Windows 7 laptop I am running a software called NetDrive2 that mounts a network drive to my WebDAV folder so that I can access it with a drive letter.
Whenever I try to copy files from the Windows 7 laptop to my WebDAV drive, I sometimes get the error message:
Error 0x80070522: A required privilege is not held by the client."
The WebDAV folder has Basic AuthType and I have ofc provided correct user/pass. It is not SSL.
I have done some debugging myself and I am not sure, but it appears that I cannot create a folder that has the same name as a file in the same directory:
Folder:
- file.php
- file/ (cannot create this dir because file.php exists).
Anyone have any ideas? I am stuck!

OK so Googling further I finally found what was causing the problem. I cannot believe this is not mentioned in any tutorials out there.
This guy gave me the answer:
Apache Webdav, unable to create "test" folder when file test.txt exists
Basically, you have to add AllowOverride none, and Options None to your webdav directory.
This is my final configuration for my webdav host in Apache2:
Alias /devshed /home/www/sites/dev
Alias /devsheddav /home/www/sites/dev
<Directory /home/www/sites/dev/>
AllowOverride none
Order allow,deny
Allow from all
Options +Indexes +MultiViews
IndexOptions FancyIndexing
</Directory>
<Location /devshed>
DAV Off
Order allow,deny
Allow from all
AuthName "Pennybridge Devshed Web"
AuthType Basic
AuthUserFile /home/www/htaccess/sites/dev/dev.htpasswd
Require valid-user
</Location>
<Location /devsheddav>
DAV On
Options None
Order allow,deny
Allow from all
AuthName "Pennybridge Devshed WebDAV"
AuthType Basic
AuthUserFile /home/www/htaccess/sites/dev/dev.htpasswd
Require valid-user
php_flag engine off
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
DirectoryIndex disabled
</Location>

Related

How to get the REMOTE_USER variable with PHP under linux [duplicate]

Previously I used the IIS server as PHP server. Currently, it is the apache.
On IIS I could access to the variable $_SERVER ['REMOTE_USER'] which returns the username and domain (eg domain\user) but after installing XAMPP this variable is not available.
What I should do to get this variable get again?
My app is on local network with no-internet connection
Finally got it to works! :D
Download the module from here https://www.apachehaus.net/modules/mod_authnz_sspi/ (x86 for 32 bit and x64 for 64 bit apache)
Copy the mod_authnz_sspi.so from Apache24\modules folder and place it in the modules folder of your Apache folder on your webserver
Under the httpd.conf file (Config file for your apache) place this line of code. Try to load this as the last module:
LoadModule authnz_sspi_module modules/mod_authnz_sspi.so
Make sure that the following modules are uncommented
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so
PS: both the above modules are required for this to work.
Place the following code in your httpd.conf file
<Directory "path/to/your/htcdocs/folder">
Options None
AllowOverride All
Order allow,deny
Allow from all
#AuthName "SSPI Protected Place"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOfferBasic On
SSPIOmitDomain On
Require valid-user
</Directory>
Restart your apache servive and hopefully it should restart without any issues.
Now in order to recognise the user , use the following code on a php page
echo $_SERVER['PHP_AUTH_USER'];
That's all.
I'm using:
XAMPP Control Panel 3.2.1
APACHE 2.4
<Directory "path/to/your/htcdocs/folder">
Options None
AllowOverride All
Order allow,deny
Allow from all
#AuthName "SSPI Protected Place"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOfferBasic On
SSPIOmitDomain On
Require valid-user
</Directory>
If you use ModRewrite or other I suggest you to keep
Options Indexes FollowSymLinks Includes ExecCGI
otherwise you'll get an error like
[rewrite:error]: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions
You can only access the remote user if Apache has actually authenticated the user, check the apache auth howto.
I battled with this for a long time, it turned out that I had to install VC redistributable to make it work.

.htaccess Error : Invalid command 'AuthGroupFile'

before this i was working on windows and my project was working proper. recently i moved to ubuntu and i am trying setup project on LAMP.
i have created host for this (windows i was running directly through localhost) and when i am running it getting 500 Internal server Error.
when i looked in my log file i got Invalid command 'AuthGroupFile', perhaps misspelled or defined by a module not included in the server configuration.
.htaccess File
#php_value zend.ze1_compatibility_mode off
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /opt/lampp/htdocs/uniplex_mobile/.htpasswd
AuthGroupFile /dev/null
<Files manageurls.html>
require valid-user
</Files>
<Files addurl.html>
require valid-user
</Files>
<Files editurl.html>
require valid-user
</Files>
AddType application/x-httpd-php .php .htm .html
my project is on smarty framework.
can anyone help to solve this?
Thanks in advance
You can try this.
a2enmod authz_groupfile
Assuming you're using apache 2.2, this means you're missing the mod_authz_groupfile module.
You need to look in your server config and look for the line that contains:
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
or something similar and make sure it's commented out.
Otherwise, just leave out the AuthGroupFile directive, it doesn't look like you're using it anyways.

php files in phpmyadmin folder not executable

i have phpmyadmin on my amazon server installed ( in /usr/share/phpMyAdmin folder)
my phpMyAdmin.conf seems correct
i was able to access it from my browser before by typing https://xxx.xxx.xxx.xxx/phpmyadmin
After i restored my amazon instance from a snapshot , i can not access it anymore
i get this error :
Not Found
The requested URL /phpMyAdmin/navigation.php< was not found on this server.
Then i noticed Apache doesn't serve php files in that directory at all
Even when i put a minimal php file in that folder for test and point to it in browser, it will return it as a text file and i can see php codes in it!
I searched about it and found many similar issues, but none of them helped me
can anyone help me to find source of this issue?
ps: i have several virtual servers on my server and they are working fine.
here is a part of my phpMyAdmin.conf :
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
#Deny from All
Allow from all
Allow from ::1
</IfModule>
</Directory>
use this to run files inside htdocs localhost/navigation.php

How do fix apache error "not within configured docroot" under Ubuntu

Greetings experts and gurus, I am looking for some help with an apache php configuration problem.
I have been running several websites from an apache2 setup on an ubuntu server for some time now without problems using the line NameVirtualHost * in my etc/apache2/conf.d/virtual.conf file. I recently updated the server version to the latest lts version and I am now unable to run php files.
I am running all my sites for the location "/home/www/[site-name]/htdocs" and I have setup and enabled all my sites in /etc/apache2/sites-available. I have also disabled the default site.
for each sites file I have specified the following:
# Indexes + Directory Root.
# DirectoryIndex index.html index.htm index.php
DocumentRoot /home/www/[site-name]/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/[site-name]/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/[site-name]/logs/error.log
CustomLog /home/www/[site-name]/logs/access.log combined
I restart apache and enter the url for a php test page on my server and I am met with an "Internal Server Error". When I check the error log I get:
Script "/home/www/[site-name]/htdocs/test.php" resolving to "/home/www/[site-name]/htdocs/test.php" not within configured docroot.
For some reason when looking into the error, suphp came up a lot. According to this link:
Don't be fooled into thiking this has anything to do with the Apche virtual host document root, this is actually another setting in the suphp config file. Including the paths which contained the RoundCube scripts fixed this one. For example:
docroot=/var/www:/usr/share/roundcube:/var/lib/roundcube:${HOME}/public_html
You need to edit your /etc/suphp/suphp.conf file and change the docroot to whatever is appropriate.
It looks you missed the virtual hosts configuration for every site name:
<VirtualHost IP:80>
ServerName yourdomainname
ServerAlias www.yourdomainname
DocumentRoot /home/www/[site-name]/htdocs/
ScriptAlias /cgi-bin/ /home/www/[site-name]/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
ErrorLog /home/www/[site-name]/logs/yourdomainname.ua-error.log
CustomLog /home/www/[site-name]/logs/yourdomainname-access.log combined
</VirtualHost>
<Directory "/home/www/[site-name]/htdocs/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Thanks for all the help, I got there in the end. It seems that upgrading to Ubuntu 10.04 turned on suPHP. It has ended up being a good thing as the reason why I was getting errors was down to file management in my htdocs getting sloppy.
To fix my issues I had to do several things:
First I turned on suphp error messages in /etc/apache2/sites-available/[site-name]. This gave me the true error, which told me that some of my pages had the wrong permissions. I then set all my folder permissions in www to 755 and the files to 644. I also had to lower the min_uid and min_gid fileds in suphp.conf to 33.

CruiseControl access restriction: how?

I am currently testing CruiseControl + phpUnderControl for our PHP CI process and am stuck with a fairly simple question: is it possible to somehow restrict access to the web interface?
I cannot seem to find anything indicating this is possible, but I am probably overlooking something.
Why wouldn't Apache's mod_auth work?
Why don't you use mod_proxy ot redirect cruisecontrol's web interface through apache? then use apache auth. At phpexperts.pro, i have cruisecontrol listening on localhost:8080 and then i use mod_proxy like:
<VirtualHost *:80>
ServerName phpexperts.pro
<Location "/cruisecontrol/">
# Controls who can get stuff from this server.
Satisfy any
Order allow,deny
Allow from 127.0.0.1
AuthType Basic
AuthName "private"
AuthUserFile /var/www/phpexperts.pro/.htpasswd
AuthGroupFile /dev/null
Require valid-user
# Pass in CruiseControl's web interface.
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
</VirtualHost>

Categories