desktop icon indicating copy to clipboard operation
desktop copied to clipboard

Remove .htaccess from ignored file list

Open nanonettr opened this issue 8 years ago • 19 comments

.htaccess should be synced when enabling Synchronize hidden files.

Reference : https://github.com/owncloud/client/issues/5701

nanonettr avatar Dec 09 '17 21:12 nanonettr

That could override nextclouds server configuration and possibly break the file folder. Very bad idea. You could rename this file to DOT.htaccess and rename it when uploading the files to the productive webserver if its not too much PITA... But if there are more than one htaccess file this can be annoying, i understand.

JackThursby252 avatar Jan 30 '18 09:01 JackThursby252

OwnCloud made that step. Check https://github.com/owncloud/client/issues/6144

Maybe it would be nice to allow an administrator to activate/deactivate the .htaccess file from the ignore list. For example if the data-directory lies outside of the web-accessible folder.

adriansuter avatar Feb 06 '18 14:02 adriansuter

I use Nextcloud extensively to synchronize web projects across machines (usually containing .htaccess files), so this is a pretty significant annoyance especially when you pair it with git and git constantly thinks I deleted the .htaccess file every time I'm not using the machine I originally created the project on...

A simple solution would be to simply prepend a string to the ignored file prior to upload, removing the string again on download...? Maybe even hiding the string from the web interface making it completely seamless for the end user.

superDuperCyberTechno avatar Apr 06 '18 09:04 superDuperCyberTechno

Hello,

for all people they need to allow the .htaccess file.

Follow this steps:

  1. Download the owncloud client
  2. Edit following files on your nextcloud server 2.1. https://github.com/owncloud/core/blob/f10d105ea2f2d0822693313ddcd6f9b2eaac6ebe/lib/private/Files/Filesystem.php#L643 2.2. https://github.com/owncloud/core/blob/c9f5fce1777a96a8e2f09ea54fbcbed90cd1925f/apps/files/lib/Capabilities.php#L61
  3. Done :)

Be careful your data folder should not hosted on your web server. Move it to e.x /home You can change the data folder path in the config/config.php

Have fun.

ludgart avatar May 05 '18 15:05 ludgart

So is there a real solution for this yet which will survive an update? I develop websites and .htaccess is a part of that. I want to use Nextcloud to store and sync my dev work but I can't feel comfortable with unexpected file deleting going on and I don't want to be constantly on alert for missing data.

I do have my data folder outside web path so it could be just a tickbox in the admin somewhere "Do not block .htaccess" and the nextcloud server could check of the /data/ path is relative to site root and Disable the option with warning "Security warning: Do not allow .htaccess files if the /data/ folder is in your web path".

Terrox avatar Jun 08 '18 00:06 Terrox

I think administrators should have the power to edit the file ignore list via the web interface, given they know what they are doing. Which could include:

  • not using apache web server
  • using apache but locating the data directory outside of the web server's root

despens avatar Jun 11 '18 13:06 despens

+1

Nextcloud could also rename the file for security reasons (e.g. .htaccess-SAFE) but display and download it as .htaccess in clients and the web interface.

Manually renaming a file before uploading it is a massive pain if you're a web dev with lots of sites to sync, plus Windows won't easily allow renaming the files back to .htaccess (as the files lack a proper filename).

rafleo avatar Jul 09 '18 11:07 rafleo

I was going to jump on the bandwagon as I have a bunch of old projects that have .htaccess files as well, but realized that these project files shouldn't be left loose like this anyway and should be stuck in a version control system where their changes can be tracked.

Since I host my own NextCloud instance, I'm going to either move my old projects to a self-hosted GitLab CE server or perhaps utilize BitBucket or GitLab private repositories and move my old projects there. In all honesty, this is the best solution.

richardfleming avatar Aug 09 '18 19:08 richardfleming

So that means we can't do web dev work or copy web dev data through nextcloud?

Terrox avatar Aug 11 '18 00:08 Terrox

I used to use dropbox for webdev before I clued into git. Git makes it so much better to track versions of files, role back, experiment with new code and all other stuff without having to keep separate copies of everything.

Yes, you can use Nextcloud for webdev work, but it's really not the right tool. Nextcloud is used for my docs, and pictures, and that sort of sundry... Git is used for all webdev source code. (BitBucket and GitLab offer free private repositories).

Rich

richardfleming avatar Aug 11 '18 01:08 richardfleming

While Git or SVN is a better tool for backing up web work, yes, I believe we're missing the point here. There are always arguments to be made for both sides (e.g. wanting to share a private link to a web project without the users having to register anywhere) and reasons behind why someone uses a specific tool and not another one.

The point is: we want and expect Nextcloud to sync files, and in this case, it doesn't - for no good reason. I say "no good reason" because owncloud has a solution to this and there's multiple ways to solve it.

And while we as developers understand why Nextcloud ignores .htaccess files in the first place, novice users might not - and that's a problem. Especially, if you remove .htaccess from the ignored file list.

rafleo avatar Aug 11 '18 06:08 rafleo

This issue seems to relate to the following server issue: https://github.com/nextcloud/server/issues/13831

caillou avatar Mar 24 '19 16:03 caillou

I don't know in old versions, but working ok with: Nextcloud Client: 2.5.1. -> Enabled "Synchronize hidden files" Nextcloud Server: 15.0.7.0. -> Added to server file /config/config.php next line: 'blacklisted_files' => array(),

epma01 avatar Apr 25 '19 12:04 epma01

Please see my suggestion for a better solution here: https://github.com/nextcloud/server/issues/13831#issuecomment-899420286

SamSirry avatar Aug 16 '21 11:08 SamSirry

.htaccess was removed from the client's built-in ignore list prior to this issue being opened here:

https://github.com/nextcloud/desktop/commit/4697f0274f282cafd28cbad07066efb397dbf21b

It's actually the same change mentioned in the referenced https://github.com/owncloud/client/issues/5701

If you can't upload .htaccess files it's due to the server-side blacklist mentioned elsewhere in this issue. Feel free to adjust it at your discussion (it's in the Server docs if you need more details).

Closing this out.

joshtrichards avatar Nov 24 '23 15:11 joshtrichards

One can simply empty the default blacklist array in config.php to let the client sync the files:

'blacklisted_files' => array(),

Thanks to https://help.nextcloud.com/t/solved-upload-htaccess-on-php-fpm/51913/2

EDIT: This requires extra configuration for Apache, other webservers ignore the file.

C0rn3j avatar Sep 26 '24 17:09 C0rn3j

empty the default blacklist array

The problem lies in how the webserver interacts with and handles the special file .htaccess. If this file is allowed to be controlled by the user it can create serious security backdoors to the whole server.

Your suggestion should absolutely not be attempted on a production system, unless the webserver settings are changed so that it doesn't treat .htaccess as a special file.

SamSirry avatar Sep 28 '24 19:09 SamSirry

Absolutely correct, IF you use Apache, which I do not.

Forgot to put that disclaimer there though, thanks for the catch.

C0rn3j avatar Sep 28 '24 22:09 C0rn3j

Isn't it only a problem when the data directory is within the web root? So only needs to be blocked in that situation?

Terrox avatar Sep 28 '24 23:09 Terrox