Acces a webdavs share by command line utlities : Error 405

Steps to reproduce

  1. Create a public share link
  2. Access to it by an utility like winscp or Cadaver
    3.

Expected behaviour

List the content

Actual behaviour

Erreur 405 Method not allowed or Could not open Collection

Server configuration

Operating system: centos 6.9

Web server: Apache 2.2

Database:MySQL

PHP version:5.6

ownCloud version: (see ownCloud admin page) Latest 9.1

Updated from an older ownCloud or fresh install: Updated

Where did you install ownCloud from:

Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php:

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: no

`

Hi,

I need a script for a windows and a linux machine to copy each night a file in a R/W public share of my Owncloud server. I found that I can easyly script it by using winscp on Windows and cadaver on Linux.
On both clients, the connection does not work : winscp report a 405 error Method not allowed and cadaver on linux say could not open collection 302 found.

In the apache.log, I have :
192.168.1.183 - - [19/Mar/2018:14:24:17 +0100] "OPTIONS /owncloud/index.php/s/qSRvBYgZitg9aYZ HTTP/1.1" 200 16336
192.168.1.183 - - [19/Mar/2018:14:24:17 +0100] "PROPFIND /owncloud/index.php/s/qSRvBYgZitg9aYZ/ HTTP/1.1" 405 -

I precise that :
- the owncloud client is working fine
- the link of the public share is good and accessible from a web server
- AllowOverride is set to all in the httpd.conf
- SeLinux is disabled

If you have an idea ....

Thanks,
Christian.

This is what they are made for, AFAIK. Maybe you can use something like curl or wget instead.

It's not a question of tool. Curl did not copy anything, I've also have the 302 error like cadaver.

What I'm tyrying to do is the end of this documentation :
http://manuel_oc9.clear-cloud-services.fr/files/access_webdav.html

I think you might use the wrong URL to access the files. I did the following search:

https://doc.owncloud.org/server/latest/user_manual/search.html?q=webdav

and found:

https://doc.owncloud.org/server/latest/user_manual/files/access_webdav.html?highlight=webdav#accessing-public-shares-over-webdav

where the following URL is shown:

https://example.com/owncloud/public.php/dav

I think your log output shows that you're trying to access

https://example.com/owncloud/index.php/s/qSRvBYgZitg9aYZ/

which looks wrong to me.

1 Like

Thanks Tom,

I was totally focused on the public URL and it was a mistake

Finally, the command which works to write in a public RW share is :

curl -k -T /root/test.zip -L "https://qSRvBYgZitg9aYZ@myserver.mycompany.com/owncloud/public.php/webdav/"

If you want to use an authentication, just to replace public.php by remote.php

It also work with winscp on my Windows machine.