Hi, my ISP started offer a nextcloud[0] instance for its customers.
Problem is, even using rclone-latest[1] I can’t connect
config
./rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> fw
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / A stackable unification remote, which can appear to merge the contents of several remotes
\ "union"
2 / Alias for a existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Dropbox
\ "dropbox"
9 / Encrypt/Decrypt a remote
\ "crypt"
10 / FTP Connection
\ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
12 / Google Drive
\ "drive"
13 / Hubic
\ "hubic"
14 / JottaCloud
\ "jottacloud"
15 / Local Disk
\ "local"
16 / Mega
\ "mega"
17 / Microsoft Azure Blob Storage
\ "azureblob"
18 / Microsoft OneDrive
\ "onedrive"
19 / OpenDrive
\ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
21 / Pcloud
\ "pcloud"
22 / QingCloud Object Storage
\ "qingstor"
23 / SSH/SFTP Connection
\ "sftp"
24 / Webdav
\ "webdav"
25 / Yandex Disk
\ "yandex"
26 / http Connection
\ "http"
Storage> webdav
** See help for webdav backend at: https://rclone.org/webdav/ **
URL of http host to connect to
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Connect to example.com
\ "https://example.com"
url> https://cloud.wowspace.it
Name of the Webdav site/service/software you are using
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Nextcloud
\ "nextcloud"
2 / Owncloud
\ "owncloud"
3 / Sharepoint
\ "sharepoint"
4 / Other site/service or software
\ "other"
vendor> nextcloud
User name
Enter a string value. Press Enter for the default ("").
user> REDACTED
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Bearer token instead of user/pass (eg a Macaroon)
Enter a string value. Press Enter for the default ("").
bearer_token>
Remote config
--------------------
[fw]
type = webdav
url = https://cloud.wowspace.it
vendor = nextcloud
user = REDACTED
pass = *** ENCRYPTED ***
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
fw webdav
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
./rclone -vv lsd fw:
2018/12/04 20:24:31 DEBUG : rclone: Version "v1.45-021-g26b5f55c-beta" starting with parameters ["./rclone" "-vv" "lsd" "fw:"]
2018/12/04 20:24:31 DEBUG : Using config file from "/home/USER/.config/rclone/rclone.conf"
2018/12/04 20:24:31 ERROR : : error listing: couldn't list files: 405 Method Not Allowed
2018/12/04 20:24:31 Failed to lsd: couldn't list files: 405 Method Not Allowed
Official nextcloud app[2] works fine, when asked for the server it open a webview[3] where I insert username and password.
Can you help me?
thanks
[0] version should be 13.0.7.2
[1] ./rclone version
rclone v1.45-021-g26b5f55c-beta
2018/12/04 23:49:45 DEBUG : rclone: Version "v1.45-021-g26b5f55c-beta" starting with parameters ["./rclone" "-vv" "--user-agent" "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36" "ls" "fw:"]
2018/12/04 23:49:45 DEBUG : Using config file from "/home/USER/.config/rclone/rclone.conf"
2018/12/04 23:49:46 ERROR : : error listing: couldn't list files: 405 Method Not Allowed
2018/12/04 23:49:46 Failed to ls: couldn't list files: 405 Method Not Allowed
I checked the nextcloud dir in /data/data/com.nextcloud.client/
/data/data/com.nextcloud.client/shared_prefs/com.nextcloud/client_preferences.xml
has an entry called pushToken
I tested the long string with --webdav-bearer-toke without success (same error as above)
There is also this two files that have nc, maybe related to [3]
Can you try doing the login in a normal desktop browser? And see if you can get the nc://login/server:<server>&user:<username>&password:<password> string that way?
The nextcloud web interface normally shows a URL for use with a webdav client if I remember correctly.
curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" -u $USR:$PSW
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured</s:message>
</d:error>
Then I tried with the cookie extracted from my browser session.
curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" --cookie cookies.txt
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>CSRF check not passed.</s:message>
</d:error>
Then I tried with requesttoken
curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" -H 'requesttoken: 18CHARS+18CHARS+5CHARS=:43CHARS='
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured</s:message>
</d:error>
SSO for WebDAV is not supported at the moment. To use SSO in WebDAV you need to use the client login flow that we’re currently implementing in our clients. – However, native WebDAV clients likely won’t support our flow.
Good news.
After logging in with nextcloud (or owncloud) desktop client a password is saved in the keyring. Using that password you can login using webdav.
I tested it and it works.
Extract the password from the keyring and your are fine.
On linux gnome-keyring you can use secret-tool search --all --unlock server "Nextcloud"