I can't upload my projects .htaccess files
I would like to use OwnCloud to sync the code of several web projects between my development computers.
When I try, everything but my .htaccess files sync. I have three of them in the project I'm testing this with.
I removed the .htaccess rule from the /etc/ownCloud/sync-exclude.lst file.
If that rule is on other computers I'm syncing with, will that cause issues with uploading from the computer without it?
The info window on the client says: Problem: Internal Server Error for each file.
In my server's syslog, I get:
Dec 4 12:51:58 ws-prod-filehost-01 ownCloud[458]: {webdav} \OC\Files\Filesystem::rename() failed
Dec 4 12:51:58 ws-prod-filehost-01 ownCloud[6712]: {webdav} \OC\Files\Filesystem::rename() failed
Dec 4 12:51:58 ws-prod-filehost-01 ownCloud[26945]: {webdav} \OC\Files\Filesystem::rename() failed
OS: Ubuntu 12.04 My sync client is 1.4.2 OwnCloud server: 5.13 Sever OS: Ubuntu 12.04
cc @dragotin @danimo concering the sync client rules question
.htaccess is prevented by the server
@DeepDiver1975 How? Why? And how do I change that?
Probably because users can change security specific stuff when they are able to upload a .htaccess file which then gets parsed by your webserver.
See also the config.sample.php available here:
https://github.com/owncloud/core/blob/v5.0.13/config/config.sample.php#L35-L36
for the blacklisted .htaccess file.
Probably because users can change security specific stuff when they are able to upload a .htaccess file which then gets parsed by your webserver.
Hmm... Can't I fix that in the vhost file? Only allow .htaccess files to run from the docroot? Plus, I keep my data dir outside of OwnCloud's docroot... Guess I get to dive into the apache docs for a bit.
Thanks for pointing out where the blacklist is. :)
Why?
there has been a reason for sure - but I don't remember - sorry
And how do I change that?
As @RealRancor pointed out this can be changed within the config file - but I kindly ask you to be careful - .htaccess is for sure blacklisted for a good reason ....
So, my solution was to move OwnCloud's .htaccess directives into the vhost, and disabled .htaccess with AllowOverride none.
I could see .htaccess posing a danger if the data directory was in the docroot, and was not configured with the correct permissions. A user might, then, be able to go to owncloud/datadir/username/files/dir and run an insecure app from there. Or something like that.
Do any of the other core team members remember why they blacklisted .htaccess?
For web developers hoping to use OwnCloud like they do Dropbox, blocking .htaccess is very very annoying. I know my coworker keeps all his dev work in Dropbox, and there are a lot of .htaccess files in it. If he tried to switch to OwnCloud, he'd break all his work.
I consider this something of a bug. See #6189. Users expect all their files to sync. When they don't, they get confused. I was able to figure out what was going on, but I'm a web developer and sysadmin. So I know how to do this.
I just posted #6192 So, I'll close this since my initial problem is fixed.
@jerrac
Do any of the other core team members remember why they blacklisted .htaccess?
Anyone with a bit of luck and some knowledge on url construction rules will be able to execute any scripts (not only php, but any that web server is capable to execute) inside the directory that contains prepared .htaccess
that's why it was blacklisted. Pure security reasons.
EDIT: Once your data dir is outside of webserver root you don't need to reconfigure Apache. This is the best security measure by the way :tiger:
Note that .htaccess is also excluded from sync through the system ignore list.
I have the exact same problem, except for that my OC is 6.0 and my web server is nginx so there should be no threat of .htaccess files. I removed them from client's black list but at server side I get the following error:
Error webdav \OC\Files\Filesystem::rename() failed
I also looked in my config file and there is nothing about black listed files there. is there something I have to change in order for this to work?
@mohamnag
See: https://github.com/owncloud/core/issues/6188#issuecomment-29850098
@VicDeo does it mean when the data dir is located outside of www, it is safe to allow uploading .htaccess files? even with apache as web server?
if my data dir is located outside of www, it is safe to enable sync for .htaccess files?
Hi,
as this is nothing ownCloud specific but specific to your webserver you might check the documentation of your webserver or links like:
https://httpd.apache.org/docs/current/howto/htaccess.html
when the data dir is located outside of www, it is safe to allow uploading .htaccess files? even with apache as web server?
@mohamnag It is safe in case you 100% sure that none of Apache hosts provides access to your data directory from web.
thanks I see the point.
@mohamnag BTW, in case it is possible to change hosts, one can disable .htaccess processing with AllowOverride None and reject all direct requests to datadir with Deny from all to harden the protection.
http://httpd.apache.org/docs/current/mod/core.html#allowoverride
http://httpd.apache.org/docs/current/mod/core.html#directory
In this case .htaccess loses its magic and is treated as a simple text file
My data dir is also outside of Apache's reach … but I didn't understand how I can enable owncloud and the sync client to handle .htaccess files now?
You have to manually edit the clients ignore list. It's in /etc/owncloud/ on linux, I think. Can't remember where on windows, I assume the program root.